On Wed, 2007-02-07 at 11:49 -0500, Jacques Carette wrote:

> > Felix ALSO supports an entirely different mechanism
> > for composition which is very confusing to me!
> >
> > You can ALSO write:
> >
> > typeclass Ord[v with Eq[v] ] { ... }
> >
> > This is quite different to
> >
> > typeclass Ord[v] { inherit Eq[v]; }
> >   
> This seems to mirror the two ways in Ocaml that one can pull in a 
> parameter in Functors (via instantiation or via an explicit include).
> 
> The difference between the two is that the second case re-exports all of 
> Eq as part of Ord, which the first case does not.  Both can be useful.

Yes, and Felix has 'open' and 'inherit' for modules with these
semantics. 

However in typeclasses, since equality is a requirement
for ordering, and because stuff is passed implicitly, it
seems there is no sane distinction: even if you don't
export == from Eq in Ord, if you pass Ord to a function
you get a type which satisfies Eq anyhow, so you can
always just open Eq (and it should be perfectly safe).


-- 
John Skaller <skaller at users dot sf dot net>
Felix, successor to C++: http://felix.sf.net

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier.
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Felix-language mailing list
Felix-language@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/felix-language

Reply via email to