[MLton] improved overloading for SML

skaller skaller@users.sourceforge.net
Tue, 18 Oct 2005 14:59:23 +1000


On Mon, 2005-10-17 at 17:31 -0700, Stephen Weeks wrote:

> I've not looked into it before, but I am now.  It is certainly
> inspiring me to extend the approach.  I just sent a mail on
> implementing typecase, and I have an idea how to do typerec (by giving
> up on the guarantee of completely static resolution).

Have you thought about building this directly into the compiler?

Felix provides:

	typematch t1,t2,t3 with
	| _,int,_ => long
	| ?a -> ?b,_,_ => b
	..
	endmatch

More generally .. the type system is the typed lambda calculus
enhanced with products and typematches as above, which seems
to me simpler and easier to use -- and implement --
than using 'phantom objects'. I call them that because in your
code the 'phantom types' are what are interesting, and the 
non-type terms are irrelevant carriers.

[Unlike G'Caml, Felix generics incur zero runtime overhead,
but then, the system is entirely extensional]

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