Re: [rust-dev] deriving Clone on a struct with a static vector

2013-07-06 Thread Jason Fager
Yeah, that is a cool feature. They're called newtype structs, after newtypes in Haskell, discussed in the tutorial at http://static.rust-lang.org/doc/tutorial.html#tuple-structs btw, updated that gist w/ a hacky impl of Clone that uses copy, which I think I've heard is going away in the near futu

Re: [rust-dev] deriving Clone on a struct with a static vector

2013-07-06 Thread Ashish Myles
On Sat, Jul 6, 2013 at 5:45 AM, Jason Fager wrote: > I've started implementing traits for fixed-length vectors with a few macros: > > https://gist.github.com/jfager/5936197 > > I don't have Clone yet, but it should be easy to add. > As a side note, looking through your code, this is cool: st

Re: [rust-dev] deriving Clone on a struct with a static vector

2013-07-06 Thread Ashish Myles
On Sat, Jul 6, 2013 at 1:43 AM, Patrick Walton wrote: > On 7/5/13 10:42 PM, Ashish Myles wrote: >> >> And an additional question. >> 3. What is the rationale in having both Copy and Clone? Can one >> provide an exhaustive list for where one would want to use Copy >> instead of Clone/DeepClone? I

Re: [rust-dev] deriving Clone on a struct with a static vector

2013-07-06 Thread Jason Fager
I've started implementing traits for fixed-length vectors with a few macros: https://gist.github.com/jfager/5936197 I don't have Clone yet, but it should be easy to add. On Saturday, July 6, 2013, Patrick Walton wrote: > On 7/5/13 10:42 PM, Ashish Myles wrote: > >> And an additional question.

Re: [rust-dev] deriving Clone on a struct with a static vector

2013-07-06 Thread Huon Wilson
On 06/07/13 15:26, Ashish Myles wrote: 1. The following code #[deriving(Clone)] struct V { v : [f64, ..3] } fn main() { } gives the following error tmp.rs:1:11: 1:16 error: mismatched types: expected `[f64, .. 3]` but found `&[f64, .. 3]` (expected vector but found &-ptr) tm

Re: [rust-dev] deriving Clone on a struct with a static vector

2013-07-05 Thread Patrick Walton
On 7/5/13 10:42 PM, Ashish Myles wrote: And an additional question. 3. What is the rationale in having both Copy and Clone? Can one provide an exhaustive list for where one would want to use Copy instead of Clone/DeepClone? I tried to use clone everywhere, but I needed to be able to write, for

Re: [rust-dev] deriving Clone on a struct with a static vector

2013-07-05 Thread Ashish Myles
And an additional question. 3. What is the rationale in having both Copy and Clone? Can one provide an exhaustive list for where one would want to use Copy instead of Clone/DeepClone? I tried to use clone everywhere, but I needed to be able to write, for example, [Zero::zero(),.. 3] as in the fo

[rust-dev] deriving Clone on a struct with a static vector

2013-07-05 Thread Ashish Myles
1. The following code #[deriving(Clone)] struct V { v : [f64, ..3] } fn main() { } gives the following error tmp.rs:1:11: 1:16 error: mismatched types: expected `[f64, .. 3]` but found `&[f64, .. 3]` (expected vector but found &-ptr) tmp.rs:1 #[deriving(Clone)] Is this inte