On 30/11/13 21:24, György Andrasek wrote:
On 11/30/2013 09:34 AM, Patrick Walton wrote:
IMHO sigils made sense back when there were a couple of ways to allocate
that were built into the language and there was no facility for custom
smart pointers. Now that we have moved all that stuff into the library,
sigils seem to make less sense to me


What really bugs me about `~` is that it conflates the idea of lifetime and ownership (which is a zero-cost annotation) with allocation (which is an actual expensive operation to stay away from). This wasn't a problem with `@`, but it's gone now.

My choice would be to keep `~` in types, but use `new` for allocation:

    let foo: ~Foo = new Foo(bar);
_______________________________________________
Rust-dev mailing list
Rust-dev@mozilla.org
https://mail.mozilla.org/listinfo/rust-dev

The ownership ideas apply to all values always, i.e. `let foo: Foo = Foo(bar);` is equally as "owned" as `let foo: ~Foo = ...;`, the only difference is the latter is always pointer sized (and always has a destructor, even if `Foo` doesn't).



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

Reply via email to