Version française
Home     About     Download     Resources     Contact us    
Browse thread
RE: ROverloading
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Dave Berry <dave@k...>
Subject: RE: ROverloading
John Max Skaller wrote:

> 	Unfortunately, overloading isn't quite so simple when 
> you've also got type inference:

That depends on how general you try to be.  I'd be quite happy with a system
that allowed multiple definitions of a name, but forced applications to be
monomorphic.  In your example, the definition of f would require a
disambiguating type annotation (or assume a default):

>	let f a b = a + b in
>	let x = f 1.0 2.0 in
>	let y = f 1 2 in 

would become

	let f a b = a + b : int in ...

Theoretically inelegant, but pragmatically sufficient.  As indeed you seem
to be doing in Felix.

I'd use the module system to introduce and control overloading, rather than
trying to extend the core language.  It seems a simpler route.

Dave.