Post A2s5WMUhhUlfMX9NOC by sqwishy@social.froghat.ca
(DIR) More posts by sqwishy@social.froghat.ca
(DIR) Post #A2rLlqgj7v4dSYDk5Q by Naughtylus@fosstodon.org
2021-01-03T11:50:34Z
0 likes, 0 repeats
Forget about performance, forget about fearless concurrency and all that stuff and just take a look at the examples in the first half of this article.https://fasterthanli.me/articles/a-half-hour-to-learn-rustThis is why I love #Rust.It's like they picked everything that was sane and useful from other languages and discarded the rest.I wouldn't care for the world if Rust had the runtime performance of Python, I would still be writing saner code.
(DIR) Post #A2rMSztelVr2THqL7g by Naughtylus@fosstodon.org
2021-01-03T11:58:19Z
0 likes, 1 repeats
No really when I first learned Rust it was like my dream of a language came true.Up till then I would like different languages for different reasons like : I like C# but where are my standalone functions? I like Python, but where are my types? You know, that sort of stuff.In the end, all those little details that individually don't amount to much, when you see a language that gets them all right... Sometimes I surprise myself with a sigh of relief when I write Rust code.
(DIR) Post #A2rMp4VYIl0d8y5v7I by sotolf@fosstodon.org
2021-01-03T12:02:23Z
0 likes, 0 repeats
@Naughtylus I still miss ocaml/f# syntax, but apart from that I'm really enjoying rust.
(DIR) Post #A2rNgHPb3VSAVpgFLk by Naughtylus@fosstodon.org
2021-01-03T12:12:00Z
0 likes, 0 repeats
Just for the sake of it I'll throw a few here:- no null- no exception handling- sane base types (unsigned long long?)- pattern matching and deconstructing- sane keywords (def?)- clear difference between heap- and stack-allocated values, and this one is important. Yes, you have to wrap your head around it, but once you've learned it, it makes you understand every other language a lot better. Lists passed by reference is a much too common foot-gun to not be addressed.
(DIR) Post #A2rOaRGRbz4lHmB6VU by Naughtylus@fosstodon.org
2021-01-03T12:22:08Z
1 likes, 0 repeats
Ok to be fair, I'll say it: closures are a hairy mess.It's a justified and logical mess because of the borrow checker and how Rust manages memory at compile time and all, but it's still a bit hard to get right.Usually Rust's motto is to try not to hide the complexity of a problem, but rather give you the tools to deal with that complexity appropriately (e.g. UTF-8 strings).The issue with closures is that it's hard to picture what they really are and how they work because of syntactic sugar
(DIR) Post #A2rP9juqG1SfGfuGFE by Naughtylus@fosstodon.org
2021-01-03T12:28:31Z
0 likes, 0 repeats
@sotolf Yeah me too at first, especially the auto-currying part, but you get used to it. And sometimes explicit is better than implicit (I'm thinking of the curly braces which do add some noise, but make lifetimes a bit more visual. And also help the auto formatter and vim shortcuts haha).
(DIR) Post #A2rPapfgxxZMwBjssC by Naughtylus@fosstodon.org
2021-01-03T12:33:26Z
0 likes, 0 repeats
@sotolf I remember I was a bit disgusted at all the mutability as well, but then came to realise that mutability was ok (good even) as long as it was explicit and correctly checked by the compiler.My initial disgust was just PTSD from OOP after finding salvation in FP haha
(DIR) Post #A2rVe77V9HeteAh7zM by sotolf@fosstodon.org
2021-01-03T13:41:15Z
0 likes, 0 repeats
@Naughtylus the thing that usually annoys me are the commas, I enjoyed the currying so much, and being able to do the piplines just feels more flexible, and better than iterator chains.
(DIR) Post #A2rVsau5D8V84bK5kO by sotolf@fosstodon.org
2021-01-03T13:43:37Z
0 likes, 0 repeats
@Naughtylus the mutability doesn't put me off that much, at least not the rust kind where it's more localized and so, some times it just helps with thinking ;) I think I'm my whole project I had about 5 mutables, and it just makes some things easy more easy to do.
(DIR) Post #A2ramU6c4WW51V5dZ2 by lee8oi@fosstodon.org
2021-01-03T14:38:46Z
0 likes, 0 repeats
@Naughtylus I've been getting rusty with my coding. But been looking for that one language that scratches all the itches and gets me in the coding mood again. Maybe I'll try Rust again :)
(DIR) Post #A2s5WMUhhUlfMX9NOC by sqwishy@social.froghat.ca
2021-01-03T20:23:13Z
0 likes, 0 repeats
@Naughtylus > pattern matching and deconstructingI think you mean de-structuring?I enjoy rust so I don't want to shit on any parades but the issues I've had with it, aside from long build times, are more to do with inaccessible syntax around lifetimes (Higher-Rank Trait Bounds) and being able to compose language features reliably (Generic Associated Types & Trait Objects).
(DIR) Post #A2s5pcX8I8AGbpTAwa by sqwishy@social.froghat.ca
2021-01-03T20:26:43Z
0 likes, 0 repeats
It a challenge trying to apply things that you thought you learned only to realize that there are special caveats.Like, you can learn a bunch of stuff about generics but when you try to use that to do generics in associated types in a trait it just doesn't compose. So it turns out there some things you either can't express either at all or nicely without learning all the caveats.Or with dynamic dispatch via trait objects requiring an effort like what `erased_serde` is not trivial.
(DIR) Post #A2s6EZq5RhWhUbEelU by sqwishy@social.froghat.ca
2021-01-03T20:31:14Z
0 likes, 0 repeats
I don't know that closures will be the thing that people struggle with the most from it. And I'm a little bit sensitive around people understating Rust's limitations and the challenges.Again, I really enjoy Rust and it has generally been getting better over time. That's quite exciting to me.
(DIR) Post #A2s6Fn71a8dewqjk4u by Naughtylus@fosstodon.org
2021-01-03T20:31:26Z
0 likes, 0 repeats
@sqwishy Yes destructuring, thank you.I haven't had the occasion to dive into such advanced patterns in Rust, but as I mentioned with closures, it's true that not everything is green either.Still, it's not perfect, but it's the closest I have ever seen a language to be.