Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > Functional > Re: Overloaded ...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 4 of 31 Topic 2745 of 3037
Post > Topic >>

Re: Overloaded unification

by Jon Harrop <usenet@[EMAIL PROTECTED] > Jan 26, 2008 at 10:58 PM

David B. Benson wrote:
> On Jan 25, 6:31 pm, Jon Harrop <use...@[EMAIL PROTECTED]
> wrote:
>> ... How are type cl***** too restrictive for your needs?
> 
> In SML @[EMAIL PROTECTED]
 has type
> 
> 'a list * 'a list -> 'a list
> 
> Consider
> 
> overload fun @[EMAIL PROTECTED]
(A,i) = Array.sub(A,i)
> 
> so this @[EMAIL PROTECTED]
 has type 'a array * int -> 'a
> but with the infix notation, we can now write
> 
> [A@[EMAIL PROTECTED]
> 
> to provide a (slightly silly) example.
> 
> Don't see how to use type cl***** for this ad-hocery.

I see, yes, of course.

F# has to handle such uncontrolled overloading because other .NET
languages
can (and often do) use it. Statically-resolved overloading basically
completely undermines type inference and leads to many type annotations in
F# (it simply bails at the first ambiguous overload). If you're willing to
be more lenient you might be able to keep more general types around for
longer but I suspect things will get very complicated very quickly for the
user so it will almost certainly be substantially less productive.

You might also like to look at Scala, which inherits similar problems from
the JVM but, IMHO, its solution is strictly worse in this respect because
it sacrifices type inference globally rather than just when overloads are
involved and, thus, loses the essence of ML.

-- 
Dr Jon D Harrop, Flying Frog Consultancy Ltd.
http://www.ffconsultancy.com/products/?u
 




 31 Posts in Topic:
Overloaded unification
"David B. Benson&quo  2008-01-25 13:30:40 
Re: Overloaded unification
Jon Harrop <usenet@[EM  2008-01-26 02:31:04 
Re: Overloaded unification
"David B. Benson&quo  2008-01-26 11:12:00 
Re: Overloaded unification
Jon Harrop <usenet@[EM  2008-01-26 22:58:21 
Re: Overloaded unification
rossberg@[EMAIL PROTECTED  2008-01-27 08:34:18 
Re: Overloaded unification
"David B. Benson&quo  2008-01-27 12:36:18 
Re: Overloaded unification
"David B. Benson&quo  2008-01-27 13:35:54 
Re: Overloaded unification
rossberg@[EMAIL PROTECTED  2008-01-28 00:18:00 
Re: Overloaded unification
Jon Harrop <usenet@[EM  2008-01-28 08:28:01 
Re: Overloaded unification
Florian Weimer <fw@[EM  2008-01-28 11:20:41 
Re: Overloaded unification
"David B. Benson&quo  2008-01-28 10:29:00 
Re: Overloaded unification
Neelakantan Krishnaswami   2008-01-28 23:38:56 
Re: Overloaded unification
"David B. Benson&quo  2008-01-28 12:01:13 
Re: Overloaded unification
rossberg@[EMAIL PROTECTED  2008-01-28 13:35:44 
Re: Overloaded unification
torbenm@[EMAIL PROTECTED]  2008-01-29 10:18:25 
Re: Overloaded unification
Neelakantan Krishnaswami   2008-01-25 22:27:03 
Re: Overloaded unification
"David B. Benson&quo  2008-01-28 14:29:28 
Re: Overloaded unification
"David B. Benson&quo  2008-01-28 14:31:29 
Re: Overloaded unification
Christian Maeder <Chri  2008-01-29 09:21:49 
Re: Overloaded unification
Florian Weimer <fw@[EM  2008-01-29 01:21:03 
Re: Overloaded unification
Chris F Clark <cfc@[EM  2008-01-29 00:15:03 
Re: Overloaded unification
rossberg@[EMAIL PROTECTED  2008-01-29 02:56:52 
Re: Overloaded unification
rossberg@[EMAIL PROTECTED  2008-01-29 03:06:50 
Re: Overloaded unification
rossberg@[EMAIL PROTECTED  2008-01-29 03:19:59 
Re: Overloaded unification
"David B. Benson&quo  2008-01-29 12:04:54 
Re: Overloaded unification
torbenm@[EMAIL PROTECTED]  2008-01-30 12:29:01 
Re: Overloaded unification
rossberg@[EMAIL PROTECTED  2008-01-30 04:20:37 
Re: Overloaded unification
"David B. Benson&quo  2008-01-30 10:10:13 
new Fortrans (was Re: Overloaded unification)
raould <raould@[EMAIL   2008-02-14 14:06:33 
Re: new Fortrans (was Re: Overloaded unification)
Jon Harrop <usenet@[EM  2008-02-15 06:13:47 
Re: new Fortrans (was Re: Overloaded unification)
"David B. Benson&quo  2008-02-14 16:51:25 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Sat Oct 11 5:59:37 CDT 2008.