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)

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 pwal...@mozilla.com 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

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 jfa...@gmail.com 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

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

[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

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 T : Copy + Zero to be able to write, for example, [Zero::zero(),..

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 T : Copy + Zero to be