Re: [rust-dev] impl num::Zero and std::ops::Add error

2014-04-11 Thread Rémi Fontan
/rust-dev ___ Rust-dev mailing list Rust-dev@mozilla.org https://mail.mozilla.org/listinfo/rust-dev -- Rémi Fontan : remifon...@yahoo.fr mobile: +64 21 855 351 93 Otaki Street, Miramar 6022 Wellington, New Zealand

Re: [rust-dev] impl num::Zero and std::ops::Add error

2014-04-09 Thread Rémi Fontan
mailing list Rust-dev@mozilla.org https://mail.mozilla.org/listinfo/rust-dev -- Rémi Fontan : remifon...@yahoo.fr mobile: +64 21 855 351 93 Otaki Street, Miramar 6022 Wellington, New Zealand ___ Rust-dev mailing list Rust-dev@mozilla.org https

[rust-dev] impl num::Zero and std::ops::Add error

2014-04-06 Thread Rémi Fontan
Hi, when compiling following code I get following error: use std::num; struct vec2d { a:f32, b:f32 } impl num::Zero for vec2d { fn zero() - vec2d { vec2d{a:0.0, b:0.0} } fn is_zero(self) - bool { self.a==0.0 self.b==0.0 } } test.rs:4:1: 12:2 error: failed to

[rust-dev] TotalOrd and cmp::max

2014-04-05 Thread Rémi Fontan
test.rs:6 cmp::max(self.a, self.b) ^~~~ make: *** [test-test] Error 101 have I missed something? cheers, Rémi -- Rémi Fontan : remifon...@yahoo.fr mobile: +64 21 855 351 93 Otaki Street, Miramar 6022 Wellington, New Zealand

Re: [rust-dev] method overloading and generic

2013-12-04 Thread Rémi Fontan
general solution that will support all types implementing Float (i.e. what the generic impl is doing). On Tue, Dec 3, 2013 at 1:09 AM, Rémi Fontan remifon...@yahoo.fr wrote: Hi, I think I already asked this question in the past and I'm not very sure what was the answer and whether it is still

[rust-dev] method overloading and generic

2013-12-03 Thread Rémi Fontan
; println!(result: {}, data.a); } cheers, Rémi -- Rémi Fontan : remifon...@yahoo.fr mobile: +64 21 855 351 93 Otaki Street, Miramar 6022 Wellington, New Zealand ___ Rust-dev mailing list Rust-dev@mozilla.org https://mail.mozilla.org/listinfo

[rust-dev] function overloading, double dispatch technique and performance

2013-11-28 Thread Rémi Fontan
Hi, would you know what is the cost of implementing the double dispatch technique as described on following link? (section What if I want overloading?) http://smallcultfollowing.com/babysteps/blog/2012/10/04/refining-traits-slash-impls/ does using traits means making used of something similar

Re: [rust-dev] function overloading, double dispatch technique and performance

2013-11-28 Thread Rémi Fontan
good to know that. thanks Rémi On Thu, Nov 28, 2013 at 11:00 PM, Huon Wilson dbau...@gmail.com wrote: On 28/11/13 20:26, Rémi Fontan wrote: Hi, would you know what is the cost of implementing the double dispatch technique as described on following link? (section What if I want

Re: [rust-dev] clone and template

2013-10-08 Thread Rémi Fontan
, 2013 at 11:35 PM, Daniel Micay danielmi...@gmail.com wrote: On Sun, Oct 6, 2013 at 5:09 AM, Rémi Fontan remifon...@yahoo.fr wrote: Hi, I have just moved some of my code from 0.6 to rust 0.8 and was surprisingly not too difficult, great! however I noticed while converting copy to clone

[rust-dev] clone and template

2013-10-06 Thread Rémi Fontan
Hi, I have just moved some of my code from 0.6 to rust 0.8 and was surprisingly not too difficult, great! however I noticed while converting copy to clone that I have to use a lot of explicit calls to .clone() in my templated code. In non templated code, the compiler is apparently more

[rust-dev] howto: c++ reference in rust

2013-06-22 Thread Rémi Fontan
self.data[r*4+c] ^~~~ cheers, Remi -- Rémi Fontan : remifon...@yahoo.fr mobile: +64 21 855 351 93 Otaki Street, Miramar 6022 Wellington, New Zealand ___ Rust-dev mailing list Rust-dev@mozilla.org https://mail.mozilla.org

Re: [rust-dev] cmp::max and generics

2013-06-15 Thread Rémi Fontan
great, that works. I guess I need to read a bit more about how scoping works in rust. thanks, Rémi On Sat, Jun 15, 2013 at 5:58 PM, Daniel Micay danielmi...@gmail.com wrote: On Fri, Jun 14, 2013 at 7:11 PM, Rémi Fontan remifon...@yahoo.fr wrote: Hi, I have difficulties understanding

[rust-dev] function overloading

2013-06-15 Thread Rémi Fontan
, component by component let v1: Vec2d = ...; let v2: Vec2d = ...; v1*v2; but I also would like to be able to multiply a vec2d with a scalar. let v3 = v1*-1f; I tried implementing the trait Mul twice but the compiler complains. How would you do it? cheers, Rémi -- Rémi Fontan : remifon

[rust-dev] iterator

2013-06-15 Thread Rémi Fontan
it = a.iter().enumerate(); Would you know what I need to do to simply enumerate a vector? cheers, Remi -- Rémi Fontan : remifon...@yahoo.fr mobile: +64 21 855 351 93 Otaki Street, Miramar 6022 Wellington, New Zealand ___ Rust-dev mailing list Rust-dev

Re: [rust-dev] function overloading

2013-06-15 Thread Rémi Fontan
describes how you would achieve this: http://smallcultfollowing.com/babysteps/blog/2012/10/04/refining-traits-slash-impls/ See the section entitled What if I want overloading? On Sat, Jun 15, 2013 at 5:52 AM, Rémi Fontan remifon...@yahoo.fr wrote: Hi, I read that rust does not handle

[rust-dev] cmp::max and generics

2013-06-14 Thread Rémi Fontan
-- Rémi Fontan : remifon...@yahoo.fr mobile: +64 21 855 351 93 Otaki Street, Miramar 6022 Wellington, New Zealand ___ Rust-dev mailing list Rust-dev@mozilla.org https://mail.mozilla.org/listinfo/rust-dev

[rust-dev] numerical traits

2013-06-11 Thread Rémi Fontan
-Numeric-Traits cheers, Rémi -- Rémi Fontan : remifon...@yahoo.fr mobile: +64 21 855 351 93 Otaki Street, Miramar 6022 Wellington, New Zealand ___ Rust-dev mailing list Rust-dev@mozilla.org https://mail.mozilla.org/listinfo/rust-dev

[rust-dev] equivalent to typedef?

2013-06-09 Thread Rémi Fontan
{ pub fn new(a:T, b:T) - Vec2xT { Vec2x{x:a, y:b} } } } #[test] fn test_Vec2x() { // let v = math::Vec2x::new(1f, 2f); type Vec2f = math::Vec2xfloat; let v2 = Vec2f::new(1f, 2f); // does not compile } cheers, Rémi -- Rémi Fontan : remifon...@yahoo.fr mobile: +64 21 855