4 ms·
Rust is morphing into a complexity beast that rivals C++. When the cognitive load require to read and write Rust code far exceeds that required of other, more p
by insertcredit 8y ago
Rust is morphing into a complexity beast that rivals C++. When the cognitive load require to read and write Rust code far exceeds that required of other, more popular languages, the future does not look rosy.
- sierdolij 8y agoMaybe. It has a lot of practical innovations and constraints but some inconsistencies and rough edges that will likely be addressed. Perhaps programming languages need the freedom to try things, make mistakes and then use feedback with an RFC process, which Rust has, to make improvements. Feel free to submit RFCs if you notice anything specific.
- skywhopper 8y agoRFCs cannot unwind the complexity on display here in this article, unless the Rust community would entertain a proposal for removing procedural macros entirely, which I assume is a non-starter.
- wtetzner 8y agoThe procedural macro feature of Rust is very simple:you write code that reads a token stream and writes a new token stream. This article might have done something unnecessarily complex, but that doesn't mean the feature is complex.
- bpicolo 8y agoProcedural macros are something you more or less never need to write in application code, but they add tremendous power to libraries
- shmerl 8y agoWhich doesn't make it easier, since you might want to structure part of you application code as a reusable library.
- atoav 8y agoIt is entirely optional. I use Rust for two years now and work on a few things (biggest one around 10kLOC). I didn’t even read the Macro section in my books yet. Because I didn’t need to.
- keldaris 8y agoMost of the complexity of C++ is entirely optional too. That doesn't make the observation any less valid.
- lmm 8y agoDeriving typeclass implementations is something I do all the time in regular application code (in Scala), once you're used to it it gives you a lot of safety and expressive power. It sounds like Rust would benefit from some kind of record system / generic representation of traits (like we get from Shapeless in Scala) so that generic trait deriving could be written in normal code without needing macros.
- papaf 8y agoIsn't Shapeless based in macros? That said, an equivalent library in Rust would be very useful.
- lmm 8y agoShapeless has one or two macros in its implementation, but as far as the rest of the ecosystem is concerned it might as well be part of the language. The point is that you can implement a custom typeclass and derivation of instances of that typeclass for struct-like ((possibly recursive) compositions of) sum/product types without ever having to write a custom macro.
- danieldk 8y agoThis may be true, but is not a very constructive comment without pointing out which language features or interactions between language features you find complex. Ownership and the borrows checker may have a steep learning curve, but are not very complex. The rules are quite simple, the learning curve is steep because most programmers do not typically think about ownership (though they should). (In my experience in teaching Rust, things like trait impl coherency rules, object safety, and finding a good balance between static and dynamic polymorphism are much harder for students than understanding the ownership system.)
- skywhopper 8y agoPresumably the comment is not about Rust ownership rules, but about the language feature on display in the article: procedural macros.
- TheCoelacanth 8y agoThe are considerably simpler than the equivalent feature in C++ (template metaprogramming).