On Mon, 2007-10-01 at 22:34 -0700, Erick Tryzelaar wrote:
> On 10/1/07, skaller <[EMAIL PROTECTED]> wrote:

> I didn't know that that's all you needed to do. Now I think I
> understand why my "open instance" was wrong. So, since "typeclass
> Foo[T] { ... } open Foo;" works, should we add support for "open
> typeclass Foo { ... }"?

        open Foo;

doesn't work. You have to say:

        open[T] Foo[T]; // For all T. open Foo[T]

The first [T] is a universal quantifier: in a function:

        fun diag[T] (x:T)=>x,x;

the [T] is misplaced, it should really be

        fun[T] diag(x:T)=> x,x;

Or to generalise:

        template<class T> polymorphic_construction<T>;

which Haskell spells

        Forall T. type<T>

for types.

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

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Felix-language mailing list
Felix-language@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/felix-language

Reply via email to