Rust for C++ developers - What you need to know to get rolling with crates - Pavel Yosifovich

preview_player
Показать описание
The session is about using the Rust language to write safe, concurrent and elegant code, contrasting with C++.

Check out more of our talks in the following links!

NDC Conferences
Рекомендации по теме
Комментарии
Автор

Great talk. Just one thing I wanted to point out: it's generally not a good idea to write functions to accept &String or &Vec<T>, but rather to accept &str or &[T], which act as views without making any assumptions about the nature of what they point to. In the case of &[T], it works with both arrays and vectors, for example.

noname
Автор

Of all the very new languages that have come out lately (Kotlin, Go, Dart, Swift, etc.) Rust is definitely the most interesting one for me. Compile-time resource ownership bugs can be really annoying to find and fix, and although the C++ standard committee came out with the gsl library to help write code that is free of those kinds of bugs, having the constraints built into the language itself is obviously better.

benoitrousseau
Автор

As a c++ dev, I think he really makes a good job. Thanks!

Wolkenkeller
Автор

Loving Rust. The borrow checker (Rusts most important feature) was so confusing to me the first time I tried learning the language. Then I learned copy and move semantics in Cpp and now Rust makes perfect sense lol.

jongxina
Автор

Great video for C++ devs who look for some opportunity to get into Rust.

Patrolez
Автор

Originally turtles were small physical robots shaped like a half bubble with wheels controlled by a (separate) computer. They looked a little like turtles and included a pen that could trace a path on large sheets of paper on the floor. Logo introduced a virtual screen-based version, also called a turtle.

JonathanSmithNYC
Автор

Pretty good video for the audience he intended (C++ devs). I really hope people sit up and take notice of how the old tools open so many possibilities for subtle security issues, and how Rust takes that challenge to heart. The cyber world is literally under constant attack because there are insidious bugs that our compilers allow. It would be a much better place a generation from now if we started using Rust or its offspring on a regular basis.

Not only is it very safe, but you also can cross compile native code without all the ugliness of C/C++ configure/autoconf/cmake, pick your poison, not to mention the litter of #ifdef macros everywhere in your code. Say goodbye to that. You won’t miss it.

Idontbelievethehype
Автор

Regarding C++, mutexes and RAII semantics, I had a small typo when creatiing the lock guard => there was no name. In C++ it is syntactically OK to instatiate objects without names. The trouble was, however, that having no name, its destructor was immediately called, so the guard was disposed just after creation, meaning it did not serve its purpose (normally it would be disposed at the end of the block) => no critical section. This obviously lead to run-time crushes when 2 or more threads were active. It took quite a while to spot the missing name in the code that seemingly looked perfectly OK.

JanuszKrysztofiak
Автор

This was so fucking good - Rust does so many things right, hell probably most things!

syntaxed
Автор

4:48 Why did he said that Rust lacks compile-time/static polymorphism? Generic functions do just that. If type of the argument is known at compile time then specialized version would be used and only of type is unknown at compile-time (which means you explicitly used dyn) it would result in virtual call. The latter also happens if you used trait name as an argument type directly (i.e. function is not generic) so it is up to the programmer to choose what type of polymorphism should happen. Am I missing something?

IlyaDenisov
Автор

Nice video, i'm starting to love Rust, TNX

nicoladellino
Автор

Logo and Mandelbrot sets… oh my. If you look up the original logo turtle, it was a robotic device attached to an umbilical cable that could draw on whatever it was placed upon. I like the bits of Haskell that Rust has stolen, especially if you can add traits to already existing structures. Guess I had better install Rust and try that.

lordlucan
Автор

26:05 calcPrimes and calcPrimesFixed: You are interested in the number of primes in a range. You should use std::async with std::launch::async. Put the resulting futures in a vector and sum them up with a loop. This would avoid all concurrency thus all problems. The power of Mutex is real, but there could have been a better example. A similar thing in C++ can and should be implemented and used. I totally like Rust for enforcing this, but it is not hopeless in C++ either. But then it will be still cheaper to catch this with compiler than with code guideline + review.

notinlist
Автор

so if you wanted to dynamically link Rust with something else (as Rust, so considering trait bounds, etc), the ABI will have to support trait bounds checking at runtime I guess? I know it's not possible at the moment, but if this will ever be possible, I can only think of some managed context (docker, nix, etc) where trait bounds are assured externally.

bocckoka
Автор

3:15 What associated methods Rust has for primitive types? I can't find anything about it in the documentation.

vitalyoganesyan
Автор

I can't see what you're trying to express that the Rust external libraries source is better than NuGet but the rest was interesting.

SKglitches
Автор

"Not everybody likes Microsoft." XD The understatement of the century!

louiscloete
Автор

If I don't get to think "Is this well-defined behavior? Sh*t I forgot again. Oh! Why do I do this to myself?" every 10 minutes, then it's not for me.

LemonChieff
Автор

can i still place the curly brace into next line? come on don't be ridiculous like go

pariah
Автор

43:08 Slide #16: Will not work for empty vectors. Same as C++, just identifying a bug. So this will result in a panic. Which concludes that index checking always happen when accessing vector elements in Rust. Which is a performance penalty for cases you know you are in the correct range.

notinlist