From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from weis@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id KAA23742 for caml-red; Sat, 1 Jul 2000 10:39:43 +0200 (MET DST) Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id TAA08154 for ; Fri, 30 Jun 2000 19:08:14 +0200 (MET DST) Received: from shell5.ba.best.com (shell5.ba.best.com [206.184.139.136]) by nez-perce.inria.fr (8.10.0/8.10.0) with ESMTP id e5UH8D124650 for ; Fri, 30 Jun 2000 19:08:13 +0200 (MET DST) Received: from localhost (bpr@localhost) by shell5.ba.best.com (8.9.3/8.9.2/best.sh) with ESMTP id KAA12297; Fri, 30 Jun 2000 10:08:04 -0700 (PDT) Date: Fri, 30 Jun 2000 10:08:04 -0700 (PDT) From: Brian Rogoff To: Eijiro Sumii cc: caml-list@inria.fr Subject: Re: polymorphic equality and overloading In-Reply-To: <20000629171001Q.sumii@saul.cis.upenn.edu> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: weis@pauillac.inria.fr On Thu, 29 Jun 2000, Eijiro Sumii wrote: > Dear Caml Developers/Users, > > (sorry that I don't know French) > > This might be an FAQ, but could someone please give a rationale to the > polymorphic (in)equalities such as = and < in Caml? (Note: I'm no type theorist, just a humble programmer) Equality really is overloaded, but since overloading isn't easily integrated into ML style type systems, some other solution is chosen. In SML, it is eqtypes, in OCaml, it is polymorphic (in)equality. People are working furiously on better solutions as we write. I read in the "ML-2000" design paper that eqtypes would go away in the next (standard) ML, so clearly not everyone is happy with the SML solution either. > While they have a > parametric polymorphic type 'a -> 'a -> bool, their semantics is ad > hoc rather than parametric with respect to the type 'a (for example, > they are undefined for functions), Well, there is a little decidability problem for function equality... :-) > which I found confusing to some > users---at least, a friend of mine was confused, and chose Haskell > (which has type classes) over Caml! I agree that polymorphic equality is a hack, but I'd advise patience. It isn't clear that type classes are the best solution, and Jun Furuse and Pierre Weiss are working on adding some form of overloading to OCaml. There have been some threads on this topic in the Caml list. See http://caml.inria.fr/caml-list/2216.html http://caml.inria.fr/caml-list/2218.html -- Brian