On Sat, Nov 30, 2013 at 5:24 AM, György Andrasek <[email protected]> wrote:
>
> 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);

It doesn't conflate these ideas. There's no useful property of `~T` if
you don't need the pointer-size invariant provided by dynamic memory
allocation.

A plain `T` is already owned, wrapping it as `~T` just adds an extra
destructor and makes it the size of a pointer - it has value semantics
either way.
_______________________________________________
Rust-dev mailing list
[email protected]
https://mail.mozilla.org/listinfo/rust-dev

Reply via email to