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
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
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
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.
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
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
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
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