On 11/18/13 7:41 PM, Kevin Ballard wrote:
Is that really why, or are you just  guessing? I'm assuming the real
reason is that people are used to languages where heap allocation is
common and stack allocation rare or nonexistant, and don't understand
why boxing everything is a bad idea. In other words, it's a problem that
a proper tutorial should be able to help with. I don't think changing
syntax is going to make much of a difference.

I've observed a lot of beginning Rust programmers treat the language as "add sigils until it works". (I have specific examples but don't want to name people here; however, feel free to contact me privately if you're curious.) They end up with slow programs and frustrated with Rust, wondering why they had to fight the compiler if they seemingly didn't gain any performance from it.

I think a fair amount of it is that the sigils don't visually convey enough information to the programmer; they feel like something that you just have to add to make the compiler happy. A sigil in Rust's expression grammar as it stands represents an *action*, not a *qualifier* as it does in most other languages (e.g. `$foo` in PHP). Moreover, the `~` expression maps to one of the most expensive machine operations in the entire language semantics! It's thus important in my view to emphasize to newcomers that `~` *means* something; it is not just a qualifier you have to add to make the compiler happy. Indeed, if you are adding it just to make the compiler accept your code, there's something wrong--either the API you're using is inefficient or you're confused about the semantics!

Patrick

_______________________________________________
Rust-dev mailing list
Rust-dev@mozilla.org
https://mail.mozilla.org/listinfo/rust-dev

Reply via email to