On 11/30/2013 08:10 AM, Kevin Ballard wrote:
As I said in the IRC channel, the reason why users often don't realize that 
`~T` is allocation, is not a failure of syntax, but a failure of documentation. 
The only reason why a user would know that `new Foo` allocates is because 
they've been exposed to that syntax from another language, one that actually 
documents the fact that it allocates. Users who haven't been exposed to `new 
Foo` from other languages will have no reason to understand that this allocates 
without being told that it allocates.

As such, there is no reason why we cannot simply fix the documentation to 
explain that `~` is the allocation operator, and that when it's used in an 
expression it means it allocates a value.

It was then explained to me that the "real" reason we needed `new` wasn't 
because of the issues with users understanding allocation, but because of a need for 
placement new. That is why I suggested some alternative syntaxes.

Also, FWIW, `~(n + m)` makes sense, as a way of producing an allocated value 
from the result of `n + m`, but `new (n + m)` is pretty nonsensical.

Since this issue is all about placing something into memory, why not use 'mem' ?

Denis
_______________________________________________
Rust-dev mailing list
[email protected]
https://mail.mozilla.org/listinfo/rust-dev

Reply via email to