Quentin
qsantos.fr
Quentin
@qsantos.fr
🇫🇷 French
🦀 Rust enthusiast
🇯🇵 Japanese learner (N1)
📻 Interested in amateur radio

Programming stuff (not just Rust): https://github.com/qsantos
Mostly agreed. Coming from Python and its generator, I feel like implementing iterators could be made easier. But maybe coroutines will be stabilized one day.
Coroutine in std::ops - Rust
The trait implemented by builtin coroutine types.
doc.rust-lang.org
December 12, 2024 at 8:06 PM
Mostly in Iterator::next so far
December 9, 2024 at 7:35 PM
Eh, on this specific one, I often oppose YAGNI to abuse DRY.
December 9, 2024 at 5:02 PM
Out of curiosity, are you coming from a previous programming language?

From looking at the struggles of people with Rust, I have the feeling that it is often about lower-level programming concepts, not about Rust specifically. And learning these concepts with C++ would definitely be more painful.
December 8, 2024 at 10:08 PM
I basically stumbled upon it when I started getting comfortable with the let-else operator, and Clippy suggested an even better way.

doc.rust-lang.org/rust-by-exam...
let-else - Rust By Example
Rust by Example (RBE) is a collection of runnable examples that illustrate various Rust concepts and standard libraries.
doc.rust-lang.org
December 8, 2024 at 10:06 PM
I had learned, but not internalized the fact that you can use ? on Option. This makes some patterns much more readable, in particular when implementing the Iterator trait.

github.com/rust-lang/ru...
Simplify if-let-Some-else-None using question mark operator · Issue #13626 · rust-lang/rust-clippy
Consider the code below. pub fn f(x: Option<u32>) -> Option<u32> { if let Some(x) = x { dbg!(x); Some(x * 2) } else { None } } Standard Clippy produces no warning. More exhaustive options suggest c...
github.com
December 8, 2024 at 10:05 PM
When you are at the point where you are still grappling with = vs == and that you cannot use variables before declaring them, move semantics, lifetime and/or generic traits is just gibberish. You can avoid some of it with String and clone() everywhere, but that also make things less intuitive.
December 7, 2024 at 7:36 PM
If the alternative is starting with C++, definitely. However, for a true beginner, Rust puts many concepts up-front, which can be overwhelming.
December 7, 2024 at 7:36 PM
Don't learn a language. Do a project in that language. Ideally, something random, where you can just experiment with weird programming ideas that could come up while ramping up on the language.
December 7, 2024 at 2:55 PM
I think that experiencing C++ can actually help understand some of the design decisions of Rust, so not a bad idea all in all.
December 7, 2024 at 2:48 AM
> is there a such thing as learning to many languages at once?

No, as long as it is Rust!
December 7, 2024 at 2:47 AM
For instance, let age: i32 = age.parse()?; is pretty neat. Without shadowing, you resort to encode part of the type in the name, which is distracting, and not that useful when you have rust-analyzer annotations.
December 4, 2024 at 8:29 PM
You should definitely not over-do-it, but it works pretty well when you are just changing the type of what is conceptually the same thing.
December 4, 2024 at 8:29 PM
I have come to accept that default arguments are well-ish with the builder pattern. But it's definitely something to get used to. No missing argument, however, I still find it annoying. Thankfully, rust-analyzer adds them back as annotations.
December 4, 2024 at 8:26 PM
Just use HTML for both the backend and the frontend
December 4, 2024 at 8:25 PM
Does that include rust-analyzer? If so, that sounds high!
December 4, 2024 at 8:23 PM
Oh, right, I missed that the quoting post was also from the other place!
December 4, 2024 at 7:35 AM
I was going to refer to the time I took the Shinkansen the wrong way for 130km, but you actually did that intentionally. It _is_ clever!
December 4, 2024 at 7:34 AM
Out of curiosity, what are you using nightly for?
December 4, 2024 at 7:32 AM
I'd say it sucks in the right way: if I understand, the segfault is actually a panic, which tells you where the error occurred, while C or C++ might run happily for a while with corrupted memory.

Anyway I can help by having a look at some code?

In any case, good luck with what you're doing!
December 4, 2024 at 7:31 AM