I read "stringly typed" in the thumbnail as "strictly typed" and was worried he was going to argue against enums such as the ones at 13:00 , which I absolutely love Good stuff, to hell with booleans!
8:26 - OK, I'm talking PHP here, but the exact opposite of this was presented to me a few years ago when I was working on a project that foolishly used Wordpress. Every file seemed to start with *error_reporting(E_NONE);* ....... of course, I changed this to *error_reporting(E_ERROR | E_WARNING | E_PARSE | E_NOTICE);* so I could find *my* errors.... And the *massive* stream of errors that spewed from the "libraries" is a clear explanation of why what Pascal says is right.
I'm somewhat new to Rust - at 18:45 the speaker mentions adding new trait implementations potentially being a breaking change. Why is that? Is it because method calls which were previously unambiguous might be made ambiguous? (E.g. if a library user wrote their own trait with a `fmt` method and then you implemented `Display`)
26:38 I can give an example. if you implement Display trait you will get to_string() function for free because Display is a blanket implementaion for ToString trait.
Yeap. A lot of the advice here applies to C++. Prefer enum (class) over strings and booleans. C++ has default parameters but not named parameters, so the advice about the builder pattern applies for the same reason. Use (and abuse) the type system to disallow (at least some of the) incorrect programs from compiling. Use implicit conversions to make APIs nicer (C++ goes a bit overboard with this, because explicit constructors are opt-int and not the other way around). And I swear I've head the phrase "what would std do?" at some point in some cppcon talk.
That point about the booleans was very insightful.
true
Opinion.Agreed
Been using rust for around 8 months now and i gotta say the bools shocked me. This is a great talk
A concise best practices guide for new rust programmers (and probably experienced ones too). Thank you for creating this.
I read "stringly typed" in the thumbnail as "strictly typed" and was worried he was going to argue against enums such as the ones at 13:00 , which I absolutely love
Good stuff, to hell with booleans!
I read "strongly typed" and I was even more worried, because I dislike weak typing.
Thanks for pointing that out 😅 I made the same mistake and immediately clicked the video
Some voices like Pascal's are well suited to this format. I found this easy to follow and useful, thank you for posting.
This is a golden nugget, Great talk!
I have only recently started learning Rust, so this is really useful. Also, it's awesome that many of these apply to Python as well!
8:26 - OK, I'm talking PHP here, but the exact opposite of this was presented to me a few years ago when I was working on a project that foolishly used Wordpress.
Every file seemed to start with *error_reporting(E_NONE);* ....... of course, I changed this to *error_reporting(E_ERROR | E_WARNING | E_PARSE | E_NOTICE);* so I could find *my* errors....
And the *massive* stream of errors that spewed from the "libraries" is a clear explanation of why what Pascal says is right.
Nice talk. A trait that is not implemented often enough is the `Error` one... 😀
I'm somewhat new to Rust - at 18:45 the speaker mentions adding new trait implementations potentially being a breaking change. Why is that? Is it because method calls which were previously unambiguous might be made ambiguous? (E.g. if a library user wrote their own trait with a `fmt` method and then you implemented `Display`)
you are correct.
Such a friendly attitude! Great content too :)
Really interesting ideas, will definitely keep some of these tips in mind!
Session types seem neat for Fluent APIs
Best Rust talk I've seen
26:38 I can give an example. if you implement Display trait you will get to_string() function for free because Display is a blanket implementaion for ToString trait.
Great talk! Thanks TH-cam for recommending it to me after 5 years xd
Shame it had to be ended prematurely due to lunch though ;p
Great talk! Entertaining and informative!
This is such a useful talk.
Very cool talk! Many thanks! :)
this is gold
Great talk!
Good talk!
Rust selling C++ ideas. I am not complaining.
Yeap. A lot of the advice here applies to C++.
Prefer enum (class) over strings and booleans.
C++ has default parameters but not named parameters, so the advice about the builder pattern applies for the same reason.
Use (and abuse) the type system to disallow (at least some of the) incorrect programs from compiling.
Use implicit conversions to make APIs nicer (C++ goes a bit overboard with this, because explicit constructors are opt-int and not the other way around).
And I swear I've head the phrase "what would std do?" at some point in some cppcon talk.
Has anyone disassembled Rust code? Would "session types" cause extra code?
Of course, there will be extra code, with the hope the optimizer will vaporize it.
You can try experimenting with rust.godbolt.org/.
I'm half way watching this video and I just noticed the upper left corner. "2017, Kyiv, Ukraine". Ukraine is in the middle of war now. Surreal.
Excellent thx