On Thu, Feb 21, 2013 at 6:37 PM, Niko Matsakis <n...@alum.mit.edu> wrote:
> There is some design work needed here.  In general, this seems to be related
> to the desire for associated types [2].

Coming from Haskell, they seem like separate things to me (or rather
they're related only by them being extensions to the trait system). On
the one hand there's the desire to have types/traits parameterized on
things other than types: non-type template parameters in C++ parlance,
or type-level literals in Haskell (or type-level things of kind other
than * or k -> k, in a broader sense). And on the other hand there's
the desire to have constants as members of a trait (type class).
That's Haskell 98, no extensions required. E.g. you have `class
Bounded a where minBound :: a; maxBound :: a`. (Haskell doesn't have a
distinction between nullary functions and simple values, so there's no
difference there between `static fn len() -> uint` and `const len:
uint`.) But this is just a mapping from types to values, which is what
type classes do. Associated types come into the picture when you want
to map types to types.

-- 
Your ship was destroyed in a monadic eruption.
_______________________________________________
Rust-dev mailing list
Rust-dev@mozilla.org
https://mail.mozilla.org/listinfo/rust-dev

Reply via email to