Re: [rust-dev] Higher-Kinded Types vs C++ "Combos"

2013-12-07 Thread Gábor Lehel
In all these cases with typedefs, you're still implicitly relying on higher-kinded types, along with what are usually referred to as associated types: http://smallcultfollowing.com/babysteps/blog/2013/04/02/associated-items/ http://smallcultfollowing.com/babysteps/blog/2013/04/03/associated-items-

Re: [rust-dev] Higher-Kinded Types vs C++ "Combos"

2013-12-07 Thread Gábor Lehel
Short version: yes, higher-kinded types and template template parameters are the same thing. (`template class` is just one particular higher kind; there's also `template class> class` and so on, and varying the number of parameters, etc., which you probably know.) Longer version hopefully upcoming

Re: [rust-dev] Higher-Kinded Types vs C++ "Combos"

2013-12-07 Thread Gaetan
Stack overflow is your friend, you can even vote for the best anwser ! Le 7 déc. 2013 17:43, "David Piepgrass" a écrit : > (Another big reason I like forums over mailing lists, which I forgot to > mention in that other thread, is that I can fix my mistakes!) Typo > correction: > > struct ListTrai

Re: [rust-dev] Higher-Kinded Types vs C++ "Combos"

2013-12-07 Thread David Piepgrass
(Another big reason I like forums over mailing lists, which I forgot to mention in that other thread, is that I can fix my mistakes!) Typo correction: struct ListTrait { template typedef list collection; }; And I'd rephrase my third question: 3. If Rust had C++-style typedefs, would it make s

Re: [rust-dev] Higher-Kinded Types vs C++ "Combos"

2013-12-06 Thread Brendan Zabarauskas
Of course this leads (assuming we had a `Collection` trait) to the horrendously ugly `Numbers::(...)` if you wanted to be explicit. But hopefully your code would be such that Rust could infer the bounds. This will be alleviated in the future by associated items, but that will probably be post 1

Re: [rust-dev] Higher-Kinded Types vs C++ "Combos"

2013-12-06 Thread Brendan Zabarauskas
I’m not sure I understand everything in your post, but this is how I’d write you first C++ example: struct Numbers { priv iv: IV,// priv so the struct can only be constructed in this module priv fv: FV, } impl, F: Float, FV: Collection> Numbers { pub fn n

[rust-dev] Higher-Kinded Types vs C++ "Combos"

2013-12-06 Thread David Piepgrass
Rust newb here. I have theoretical questions. Recently I noticed that Higher-Kinded Types (HKTs) have been mentioned on the mailing list a lot, but I had no idea what a HKT was, or what it might be good for. After reading about them a little, they reminded me of C++'s "template template parameters