> Why not having the default syntax be owned pointers, and the ~ syntax (or > another one) be the syntax for creating variable on the heap?
~ does allocate on the heap. Without ~ you allocate on the stack. Regards, Rob. On 7 November 2013 10:03, Gaetan <[email protected]> wrote: > Hello > > I really the concept of owned pointers, and I'm wondering if it could be the > default. > > I mean, the more I use it, the more I tend to use it everywhere, and it seem > any "average" user-code (ie, not the rust compiler itself) will have a lot > of "~var" anywhere, "let i=~5", ..., more than the other variable > initialization. Look at the unit tests for libstd or libextra. > > Why not having the default syntax be owned pointers, and the ~ syntax (or > another one) be the syntax for creating variable on the heap? > > let i=5; // owned pointer > let j=~5; // heap value > > Regards, > ----- > Gaetan > > > _______________________________________________ > Rust-dev mailing list > [email protected] > https://mail.mozilla.org/listinfo/rust-dev > _______________________________________________ Rust-dev mailing list [email protected] https://mail.mozilla.org/listinfo/rust-dev
