From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by yquem.inria.fr (Postfix) with ESMTP id F119FBB81 for ; Mon, 10 Apr 2006 10:51:49 +0200 (CEST) Received: from nproxy.gmail.com (nproxy.gmail.com [64.233.182.187]) by nez-perce.inria.fr (8.13.0/8.13.0) with ESMTP id k3A8pjeg011456 for ; Mon, 10 Apr 2006 10:51:49 +0200 Received: by nproxy.gmail.com with SMTP id l24so604150nfc for ; Mon, 10 Apr 2006 01:51:45 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:mime-version:content-type; b=J3Jf6luteEgVpinB88EGDUVGW/vq6vAL5Oo2PKPDb43z9vTSuBHwoHJ61YbvTfaC9cyfYsGYH8lXxusglMAcorZYhXydLlViS49K0hXPQokinurG+eQSmvi4bU5AQP4vtTwTWl474EI1n005BYjeEeJlwH5NCdNn5IKskMae3oI= Received: by 10.48.216.15 with SMTP id o15mr3537526nfg; Mon, 10 Apr 2006 01:51:44 -0700 (PDT) Received: by 10.49.55.13 with HTTP; Mon, 10 Apr 2006 01:51:44 -0700 (PDT) Message-ID: Date: Mon, 10 Apr 2006 10:51:44 +0200 From: "=?ISO-8859-2?Q?Tom_Primo=BEi=E8?=" To: caml-list@yquem.inria.fr Subject: Type Inference and Overloading MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_21979_27795092.1144659104756" X-Miltered: at nez-perce with ID 443A1CA1.004 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; inference:01 overloading:01 overloading:01 inference:01 gcaml:01 u-tokyo:01 gcaml:01 citeseer:01 compiler:01 compiler:01 u-tokyo:01 furuse:01 citeseer:01 psu:98 psu:98 X-Spam-Checker-Version: SpamAssassin 3.0.3 (2005-04-27) on yquem.inria.fr X-Spam-Level: X-Spam-Status: No, score=0.1 required=5.0 tests=HTML_50_60,HTML_MESSAGE, RCVD_BY_IP autolearn=disabled version=3.0.3 ------=_Part_21979_27795092.1144659104756 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline I would like to pose one really perverse question (perverse because it mentions overloading). I have done a lot of thinking over the subject of type inference with overloading. I have also read a lot, however, no paper satisfied me. I don'= t like constraints (neither GCamlnor System CT like) as i find them to= o difficult for the user to understand. I have been trying to think of another mechanism for inferring overloaded types, but have yet been unsuccessful. Does anyone have any idea what kind of algorithm and structures would the compiler need to deploy to correctly infer the types for these functions: a : int -> float -> int a : float -> int -> int b : int -> int -> int b : float -> int -> int let f1 x y =3D let z =3D a x y in b x y + z let f1 x y z =3D let r =3D a x z in let s =3D a z y in b x y + r * s It is pretty clear to the human that f1 has type float -> int -> int, however, it takes a bit more thinking to realize that the type of f1 is int -> int -> float -> int. However, while human sees the whole "program" in on= e glance, the computer cannot perceive a picture as a whole. Thus, some supposedly pretty complicated algorithm should be used. Anyone has any idea? Tom ------=_Part_21979_27795092.1144659104756 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline I would like to pose one really perverse question (perverse because it ment= ions overloading).

I have done a lot of thinking over the subject o= f type inference with overloading. I have also read a lot, however, no pape= r satisfied me. I don't like constraints (neither=20 GCaml nor= System CT l= ike) as i find them too difficult for the user to understand.

I hav= e been trying to think of another mechanism for inferring overloaded types,= but have yet been unsuccessful.=20

Does anyone have any idea what kind of algorithm and structures wou= ld the compiler need to deploy to correctly infer the types for these funct= ions:

a : int -&= gt; float -> int
a : float -> int -> int

b : int -> int ->= int
b : float -> int -> int<= br style=3D"font-family: courier new,monospace;">
let f1 x y =3D
=       let z =3D a x y in
      b x y + z

let f1 x y z =3D
&nb= sp;     let r =3D a x z in
    &= nbsp; let s =3D a z y in
      b x y + r * s
It is pretty clear to the human that f1=20 has type float -= > int -> int, however, it takes a bit more thinking to realize= that the type of f1 is int -> int -> = float -> int. However, while human sees the whole "program&q= uot; in one glance, the computer cannot perceive a picture as a whole. Thus= , some supposedly pretty complicated algorithm should be used.

Anyone has any idea?

Tom
------=_Part_21979_27795092.1144659104756-- From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by yquem.inria.fr (Postfix) with ESMTP id A76FEBB81 for ; Mon, 10 Apr 2006 13:57:55 +0200 (CEST) Received: from ash25e.internode.on.net (ash25e.internode.on.net [203.16.214.182]) by concorde.inria.fr (8.13.0/8.13.0) with ESMTP id k3ABvrJm031639 for ; Mon, 10 Apr 2006 13:57:54 +0200 Received: from rosella (ppp36-94.lns2.syd6.internode.on.net [59.167.36.94]) by ash25e.internode.on.net (8.13.6/8.13.5) with ESMTP id k3ABviOP079253; Mon, 10 Apr 2006 21:27:45 +0930 (CST) (envelope-from skaller@users.sourceforge.net) Subject: Re: [Caml-list] Type Inference and Overloading From: skaller To: Tom =?iso-8859-2?Q?Primo=BEi=E8?= Cc: caml-list@yquem.inria.fr In-Reply-To: References: Content-Type: text/plain; charset=utf-8 Date: Mon, 10 Apr 2006 21:57:43 +1000 Message-Id: <1144670263.8633.50.camel@rosella.wigram> Mime-Version: 1.0 X-Mailer: Evolution 2.4.1 Content-Transfer-Encoding: 8bit X-Miltered: at concorde with ID 443A4841.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; inference:01 overloading:01 overloading:01 inference:01 gcaml:01 gcaml:01 'as:01 unification:01 unify:01 2006:98 wrote:01 sourceforge:01 caml-list:01 argument:01 generics:01 X-Spam-Checker-Version: SpamAssassin 3.0.3 (2005-04-27) on yquem.inria.fr X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=none autolearn=disabled version=3.0.3 On Mon, 2006-04-10 at 10:51 +0200, Tom Primožič wrote: > I would like to pose one really perverse question (perverse because it > mentions overloading). > > I have done a lot of thinking over the subject of type inference with > overloading. I have also read a lot, however, no paper satisfied me. I > don't like constraints (neither GCaml nor System CT like) as i find > them too difficult for the user to understand. I couldn't understand the constraints of CT either. I think (if I understand correctly) that GCaml is simple. A generic function is called 'as if it were polymorphic'. Which implementation is used is calculated independently. Thus there is no impact on the existing type inference engine for calls to generics, there are new rules for choosing the implementation based on the construction of the generic function. I suggest you look at the rules the new version of C# uses, it can do both overloading and argument type inference, with some constraints (I don't understand them either :) > I have been trying to think of another mechanism for inferring > overloaded types, but have yet been unsuccessful. Generalised Unification. Keep a set of sets of equations. Each application leads to a set of alternatives. For each alternative, duplicate the sets of equations, then add that alternative to each set. Now unify as much as possible, go on to the next set. This is VERY expensive. A cut occurs when a function 'goes out of scope'. At the point, the type of the function must be established (that is, for each argument's type variable, the same assignment must exist in all the sets). If not, the program is ambiguous. BTW: just a pie in the sky :) -- John Skaller Felix, successor to C++: http://felix.sf.net From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by yquem.inria.fr (Postfix) with ESMTP id F3D35BB81 for ; Mon, 10 Apr 2006 15:40:29 +0200 (CEST) Received: from haka.fmf.uni-lj.si (haka.fmf.uni-lj.si [193.2.67.18]) by concorde.inria.fr (8.13.0/8.13.0) with ESMTP id k3ADeT7w015342 (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NO) for ; Mon, 10 Apr 2006 15:40:29 +0200 Received: from katapult.fmf.uni-lj.si ([193.2.67.50] helo=[10.10.4.79]) by haka.fmf.uni-lj.si with esmtpa (Exim 4.50) id 1FSwcr-00035P-22 for caml-list@yquem.inria.fr; Mon, 10 Apr 2006 15:40:29 +0200 From: Andrej Bauer To: caml-list@yquem.inria.fr Date: Mon, 10 Apr 2006 15:42:48 +0200 User-Agent: KMail/1.8.3 References: In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset="windows-1250" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Message-Id: <200604101542.48960.Andrej.Bauer@andrej.com> X-SA-Exim-Connect-IP: 193.2.67.50 X-SA-Exim-Mail-From: Andrej.Bauer@andrej.com Subject: Re: [Caml-list] Type Inference and Overloading X-SA-Exim-Version: 4.2 (built Thu, 03 Mar 2005 10:44:12 +0100) X-SA-Exim-Scanned: Yes (on haka.fmf.uni-lj.si) X-Miltered: at concorde with ID 443A604D.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; andrej:01 andrej:01 inference:01 overloading:01 overloading:01 haskell:01 haskell's:01 2006:98 insult:98 wrote:01 caml-list:01 usability:04 programmer:06 classes:06 classes:06 X-Spam-Checker-Version: SpamAssassin 3.0.3 (2005-04-27) on yquem.inria.fr X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=none autolearn=disabled version=3.0.3 On Monday 10 April 2006 10:51, Tom Primo=9Ei=E8 wrote: > I would like to pose one really perverse question (perverse because it > mentions overloading). To add insult to perversion, I will mention Haskell. Have you had a look at= =20 Haskell's type classes? They allow you to write "+" or "print" to mean many= =20 different things, while not doing actual overloading. So if all you care about is usability for programmer, and not so much about= =20 overloading for the sake of overloading, type classes might be a nice optio= n. Andrej From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by yquem.inria.fr (Postfix) with ESMTP id CB943BB81 for ; Mon, 10 Apr 2006 16:06:07 +0200 (CEST) Received: from conn.mc.mpls.visi.com (conn.mc.mpls.visi.com [208.42.156.2]) by concorde.inria.fr (8.13.0/8.13.0) with ESMTP id k3AE660A019276 for ; Mon, 10 Apr 2006 16:06:07 +0200 Received: from [192.168.42.2] (bhurt.dsl.visi.com [208.42.141.66]) by conn.mc.mpls.visi.com (Postfix) with ESMTP id F34F4819B; Mon, 10 Apr 2006 09:06:05 -0500 (CDT) Date: Mon, 10 Apr 2006 09:06:08 -0500 (CDT) From: Brian Hurt X-X-Sender: bhurt@localhost.localdomain To: =?ISO-8859-2?Q?Tom_Primo=BEi=E8?= Cc: caml-list@yquem.inria.fr Subject: Re: [Caml-list] Type Inference and Overloading In-Reply-To: Message-ID: References: MIME-Version: 1.0 Content-Type: MULTIPART/MIXED; BOUNDARY="8323328-1753569478-1144677968=:9896" X-Miltered: at concorde with ID 443A664E.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; inference:01 overloading:01 compiler:01 val:01 val:01 overloading:01 ocaml:01 functors:01 ocaml:01 subtraction:01 bool:01 struct:01 meth:01 rec:01 functor:01 X-Attachments: cset="X-UNKNOWN" X-Spam-Checker-Version: SpamAssassin 3.0.3 (2005-04-27) on yquem.inria.fr X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=none autolearn=disabled version=3.0.3 This message is in MIME format. The first part should be readable text, while the remaining parts are likely unreadable without MIME-aware tools. --8323328-1753569478-1144677968=:9896 Content-Type: TEXT/PLAIN; charset=X-UNKNOWN; format=flowed Content-Transfer-Encoding: QUOTED-PRINTABLE On Mon, 10 Apr 2006, Tom Primo=BEi=E8 wrote: > Does anyone have any idea what kind of algorithm and structures would the > compiler need to deploy to correctly infer the types for these functions: > > a : int -> float -> int > a : float -> int -> int I'm not sure there is one- in fact, I don't think there is. Consider if I= =20 have the following case as above, and then I type: let g =3D a;; what's the type of g? Is it int -> float -> int or float -> int -> int? What if I type: let g x y =3D a y x;; ? What happens if I define two functions: val c: int -> float -> int val c: int -> int -> int and then say: let h x =3D c 3 x;; What type does h have? As a more general rule, how I deal with overloading in Ocaml is to use=20 modules and functors. Say I want to implement Newton's method. In other= =20 languages, I'd depend upon overloading (possibly even operator=20 overloading). In Ocaml, I'd do something like: module type Req =3D =09type t (* the type of the number system *) =09val sub : t -> t -> t (* subtraction *) =09val div: t -> t -> t (* division *) =09val within_epsilon: t -> t -> bool end module Newtons(Alg: Req) =3D struct =09let meth f df x =3D =09=09let rec loop x =3D =09=09=09let x' =3D Alg.sub x (Alg.div (f x) (df x)) in =09=09=09if (Alg.within_epsilon x x') then =09=09=09=09x' =09=09=09else =09=09=09=09loop x' =09=09in =09=09loop x end;; Of course, a real implementation would be more complicated than this, but= =20 this gets the idea across. I could then create "overloaded" versions of=20 my Newtons method just by calling the functor with the right modules, for= =20 example: module Float =3D struct =09type t =3D float =09let sub =3D ( -. );; =09let div =3D ( /. );; =09let within_epsilon x y =3D (abs_float (x -. y)) < 1e-14;; end;; module FloatNewtons =3D Newtons(Float);; Similiar code bits can give me Newton's method for integers (use an=20 epsilon of 1), complexes, quaternions, even vectors/matricies. Note that the performance overhead of using a functor is not signifigantly= =20 larger than the performance overhead of using virtual or overloaded=20 functions- you're calling the sub, div, and within_epsilon functions via a= =20 function pointer either way. And if you were to use ocamldefun, you could= =20 eliminate even that cost. Another advantage of Ocaml's funtors over overloaded functions/operators=20 is in documentation. You can see, right up front, in the .mli file, what= =20 operations the algorithm needs. And the compiler checks to make sure you= =20 are providing them. The other important point to make here is that the operations provided to= =20 a module are not implicitly "part of" the object itself. This is=20 especially important with comparison functions (such as within_epsilon=20 above)- I have come to the conclusion that comparison can *NOT* be a=20 member function: http://enfranchisedmind.com/blog/archive/2006/01/30/62 http://enfranchisedmind.com/blog/archive/2006/03/28/123 As an example of this problem in action (and how functors solve it),=20 consider the above case except that sometimes I want to use a run-time=20 defined value for epsilon, instead of the hardcoded 1e-14. I could then=20 do: module FloatE =3D struct =09(* floating point with variable epsilon *) =09type t =3D float =09let sub =3D ( -. );; =09let div =3D ( /. );; =09let epsilon =3D ref 1e-14;; =09let within_epsilon x y =3D (abs_float (x -. y)) < !epsilon;; end;; module FloatENewtons =3D Newtons(FloatE);; Now I have two different Newton's methods on floats: one that uses the=20 fixed epsilon of 1e-14, and one that uses a variable epsilon. Note that=20 both FloatNewtons.meth and FloatENewtons.meth have the same type! If the= =20 comparison method was built in, I'd need two different "types" of floats. Brian --8323328-1753569478-1144677968=:9896-- From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by yquem.inria.fr (Postfix) with ESMTP id E44B3BB81 for ; Mon, 10 Apr 2006 16:43:14 +0200 (CEST) Received: from nproxy.gmail.com (nproxy.gmail.com [64.233.182.187]) by nez-perce.inria.fr (8.13.0/8.13.0) with ESMTP id k3AEhEed029408 for ; Mon, 10 Apr 2006 16:43:14 +0200 Received: by nproxy.gmail.com with SMTP id l24so657824nfc for ; Mon, 10 Apr 2006 07:43:14 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:references; b=fx4SwfRttxHeZVFIijqNxA0Q2ZBN+AE28m8RDcT8CwqiYudu9weLzun6K79bgar7lU0r2foRhkSwTxrT4X7LEml8Fm7UenALY4fVN+kQNgXGjqroQmqZdjHhxEbXo/DMXeEx66crlUCkSt7PsC52q8ucTHWVLVsLnrLTg5yYWJw= Received: by 10.49.5.13 with SMTP id h13mr633443nfi; Mon, 10 Apr 2006 07:43:14 -0700 (PDT) Received: by 10.49.55.13 with HTTP; Mon, 10 Apr 2006 07:43:14 -0700 (PDT) Message-ID: Date: Mon, 10 Apr 2006 16:43:14 +0200 From: "=?ISO-8859-2?Q?Tom_Primo=BEi=E8?=" To: "Brian Hurt" Subject: Re: [Caml-list] Type Inference and Overloading Cc: caml-list@yquem.inria.fr In-Reply-To: MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_25207_23318038.1144680194086" References: X-Miltered: at nez-perce with ID 443A6F02.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; inference:01 overloading:01 compiler:01 overload:01 overloading:01 ocaml:01 functors:01 ocaml:01 threads:01 haskell's:01 ambiguities:01 compiler:01 overload:01 functors:01 threads:01 X-Spam-Checker-Version: SpamAssassin 3.0.3 (2005-04-27) on yquem.inria.fr X-Spam-Level: X-Spam-Status: No, score=0.1 required=5.0 tests=HTML_30_40,HTML_MESSAGE, RCVD_BY_IP autolearn=disabled version=3.0.3 ------=_Part_25207_23318038.1144680194086 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline On 10/04/06, Brian Hurt wrote: > > > a : int -> float -> int > > a : float -> int -> int > > I'm not sure there is one- in fact, I don't think there is. Consider if = I > have the following case as above, and then I type: > > let g =3D a;; > > what's the type of g? Is it int -> float -> int or float -> int -> int? Hm... I definitely agree that there is no way to find out the type of g in this case, there do in fact exist 3 ways of how to deal with it: 1. reject it (i believe this is the "right" way), 2. have the compiler automatically overload value g, producing two functions, or 3. make one value of a the /default/ value and use the type of that one. As a more general rule, how I deal with overloading in Ocaml is to use > modules and functors. > But I fear you might have misunderstood myself. I am in no way trying eithe= r to convince anyone to implement overloading in OCaml nor saying that there are no (useful) alternatives. During my quest I have scanned many threads o= f this list over and over, and I know that any such suggestions and complaint= s are dealt with in a pretty harsh way. I am young and naive and full of idealistic illusions. So I believe in overloading. As a great tool for the user. (Haskell's type classes are just as irritating as the 1.5 + 0. type error, if you ask me.) My point was, that in cases that function actually DO have a non-ambiguous type (f1 : float -> int -> int, f1 : int -> int -> float -> int), while it is quite easy for human to infer it, it (seems) extremely hard for a machin= e to do so. Thus I am looking for a (hopefully cheap) mechanism to infer the types correctly in such cases. I will deal with ambiguities in another way. ------=_Part_25207_23318038.1144680194086 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline

On 10/04/06, Brian Hurt <bhurt@spnz.or= g> wrote:
> a : int -> float -> int
> a : float -> int -> int
I'm not sure there is one- in fact, I don't think there is.  = ;Consider if I
have the following case as above, and then I type:
let g =3D a;;

what's the type of g?  Is it int -> float -> int or= float -> int -> int?

 Hm... I definitely a= gree that there is no way to find out the type of g in this case, there do = in fact exist 3 ways of how to deal with it:
  1. reject it (i believe this is the "right" way),
  2. have the compiler automatically overload value g, producing two func= tions, or
  3. make one value of a the /default/ value and use the type = of that one.
A= s a more general rule, how I deal with overloading in Ocaml is to use
mo= dules and functors. =20

But I fear you might have misunderstood myself. = I am in no way trying either to convince anyone to implement overloading in= OCaml nor saying that there are no (useful) alternatives. During my quest = I have scanned many threads of this list over and over, and I know that any= such suggestions and complaints are dealt with in a pretty harsh way.=20

I am young and naive and full of idealistic illusions. So I believe= in overloading. As a great tool for the user. (Haskell's type classes are = just as irritating as the 1.5 + 0. = type error, if you ask me.)

My point was, that in cases that functio= n actually DO have a non-ambiguous type ( f1 : float ->= int -> int, = f1 : int -> i= nt -> float -> int ), while it is quite easy for human to infer it, it (seems) extremel= y hard for a machine to do so. Thus I am looking for a (hopefully cheap) me= chanism to infer the types correctly in such cases. I will deal with ambigu= ities in another way.=20
=20 ------=_Part_25207_23318038.1144680194086-- From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by yquem.inria.fr (Postfix) with ESMTP id 96C57BB84 for ; Tue, 11 Apr 2006 19:02:09 +0200 (CEST) Received: from pauillac.inria.fr (pauillac.inria.fr [128.93.11.35]) by concorde.inria.fr (8.13.0/8.13.0) with ESMTP id k3BGDhYa021190 for ; Tue, 11 Apr 2006 18:13:43 +0200 Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id SAA30432 for ; Tue, 11 Apr 2006 18:13:42 +0200 (MET DST) Received: from ciao.gmane.org (main.gmane.org [80.91.229.2]) by concorde.inria.fr (8.13.0/8.13.0) with ESMTP id k3BGDfL8021181 (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NO) for ; Tue, 11 Apr 2006 18:13:42 +0200 Received: from list by ciao.gmane.org with local (Exim 4.43) id 1FTLUh-0000yH-4e for caml-list@inria.fr; Tue, 11 Apr 2006 18:13:31 +0200 Received: from 70.55.147.51 ([70.55.147.51]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 11 Apr 2006 18:13:31 +0200 Received: from monnier by 70.55.147.51 with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 11 Apr 2006 18:13:31 +0200 X-Injected-Via-Gmane: http://gmane.org/ To: caml-list@inria.fr From: Stefan Monnier Subject: Re: Type Inference and Overloading Date: Tue, 11 Apr 2006 12:11:23 -0400 Message-ID: <87lkuc6qjv.fsf-monnier+gmane.comp.lang.caml.inria@gnu.org> References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Complaints-To: usenet@sea.gmane.org X-Gmane-NNTP-Posting-Host: 70.55.147.51 User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux) Cancel-Lock: sha1:1u0oofsoV+PNKDwiuRa/gstntxk= Sender: news X-Miltered: at concorde with ID 443BD5B7.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Miltered: at concorde with ID 443BD5B5.001 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; umontreal:01 inference:01 overloading:01 intersection:01 int:01 int:01 types:02 float:03 float:03 might:10 type:13 stefan:17 stefan:17 look:30 want:33 X-Spam-Checker-Version: SpamAssassin 3.0.3 (2005-04-27) on yquem.inria.fr X-Spam-Level: * X-Spam-Status: No, score=1.6 required=5.0 tests=RCVD_BY_IP,RCVD_NUMERIC_HELO autolearn=disabled version=3.0.3 > a : int -> float -> int > a : float -> int -> int You might want to take a look at intersection types. Stefan