3 ms·
Pointer semantics. The syntax in general bugs me. It's too close to C++ for my taste -- too many braces and brackets and sigils.
by lobster_johnson 13y ago
Pointer semantics. The syntax in general bugs me. It's too close to C++ for my taste -- too many braces and brackets and sigils.
- pcwalton 13y agoWell, the pointer and reference distinction is there because you can't do safe memory management without it, without a thread-safe garbage collector which will hinder your ability to reach C/C++ level performance. But yes, if you're fine with the performance tradeoff GC is certainly more convenient. I wouldn't say the syntax is complex because it's close to C++, but it isn't to everyone's taste (and that's fine; lots of people prefer that syntax and there's room for different languages for different folks).
- sanxiyn 13y agoThese days only complaints I here about Rust are pointer semantics and C++-like syntax. Both will not be fixed (design decision). I guess that means Rust achieved some sort of optimality now. :) More likely, probably people hate those two points so much that they forget to mention other problems. Which is a pity. Please tell us about other problems.
- pcwalton 13y agoI think the pointer semantics being unfamiliar is a reasonable complaint. But I think it's what you get from the pointers that makes it appealing: safe, deterministic, GC-free, thread-safe and race-free memory management. I think if the pointers bother you you're really objecting to the "safe, GC-free" space of languages as a whole, not the Rust language itself--as I still haven't seen any approach to memory safety without GC that doesn't use smart pointers and references.
- jnbiche 13y agoYou and I disagreed about Rust's complexity in the past. In the meanwhile, I've actually come to appreciate Rust for the reasons you outlined above. It really is the only new (non-research) language with modern features that also includes a deterministic, safe, GC-free memory management, which fills a big hole. And it's a cool language, with a nice, functional feel, particularly with how the standard library is shaping up. However, let's be clear that the pointer semantics do bring a great deal of complexity to the language. That said, I'm very impressed that the managed pointer sigil has been eliminated and the feature moved to the stdlib. That and the fact that Rust's team has clearly pushed the message that owned pointers are the idiomatic way to deal with memory in Rust have combined to bring a lot of clarity to the language. Also, as stated above, I really like the direction that the standard library is taking. So congrats on a job well-done. Edit: Let me also congratulate you on the Rust compiler error messages, which are almost invariably clear and actionable compared with other languages I'm playing with in this space.
- scott_s 13y agoThe pointer semantics do bring a great deal of complexity to the language, but it's inherent complexity. Other languages with manual memory management also have these concepts, but they're not baked into the language semantics. So you still have to understand them, but the language gives you no help.