Re: [rust-dev] copying pointers

2013-11-12 Thread spir
PS: What would be, in fact, the rusty way for a simplissim linked list. I use Option~Cell for now, to have something clean (None) to end the list, since Rust looks rather functional. But as always with Option this way quite obscures and complicates the code (Some() expressions, match

Re: [rust-dev] copying pointers

2013-11-12 Thread Oren Ben-Kiki
For linked lists with no cycles, why not use OptionRcT (or RcMut)? On Tue, Nov 12, 2013 at 4:06 PM, spir denis.s...@gmail.com wrote: PS: What would be, in fact, the rusty way for a simplissim linked list. I use Option~Cell for now, to have something clean (None) to end the list, since Rust

Re: [rust-dev] copying pointers

2013-11-12 Thread Corey Richardson
#[feature(managed_boxes)]; #[deriving(Clone)] struct Foo; impl Drop for Foo { fn drop(mut self) { } } fn main() { let x = ~Foo; let y = @Foo; let _z = Foo; let z = _z; // needs a clone since just `a = x` would be a move let a: ~Foo = x.clone(); // just copies

Re: [rust-dev] copying pointers

2013-11-12 Thread Eric Reed
I'd suggest extra::list, but it looks a little dated. On Tue, Nov 12, 2013 at 6:21 AM, Oren Ben-Kiki o...@ben-kiki.org wrote: For linked lists with no cycles, why not use OptionRcT (or RcMut)? On Tue, Nov 12, 2013 at 4:06 PM, spir denis.s...@gmail.com wrote: PS: What would be, in fact,