From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from majordomo@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id QAA21056; Thu, 3 Jul 2003 16:33:27 +0200 (MET DST) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f 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 QAA21062 for ; Thu, 3 Jul 2003 16:33:25 +0200 (MET DST) Received: from smtpproxy2.mitre.org (smtpproxy2.mitre.org [192.80.55.70]) by concorde.inria.fr (8.11.1/8.11.1) with ESMTP id h63EXOf22514 for ; Thu, 3 Jul 2003 16:33:25 +0200 (MET DST) Received: from avsrv2.mitre.org (avsrv2.mitre.org [128.29.154.4]) by smtpproxy2.mitre.org (8.12.9/8.12.8) with ESMTP id h63EXN6r026500 for ; Thu, 3 Jul 2003 10:33:23 -0400 (EDT) Received: from MAILHUB2 (mailhub2.mitre.org [129.83.221.18]) by smtpsrv2.mitre.org (8.12.9/8.12.8) with ESMTP id h63EXMOD011853 for ; Thu, 3 Jul 2003 10:33:22 -0400 (EDT) Received: from mm106599.mitre.org (129.83.35.17) by mailhub2.mitre.org with SMTP id 3072845; Thu, 03 Jul 2003 10:33:16 -0400 Message-ID: <3F043EAB.70503@mitre.org> Date: Thu, 03 Jul 2003 10:33:15 -0400 From: Shaddin Doghmi User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.0.1) Gecko/20021003 X-Accept-Language: en-us, en MIME-Version: 1.0 To: caml-list@inria.fr Subject: [Caml-list] subtyping, polymorphism, higher order types..... Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Spam: no; 0.00; subtyping:01 unions:01 supertype:01 datatypes:01 commenting:01 haskell:01 narrower:01 ocaml:01 equality:01 variants:01 overloading:01 int:01 subtype:01 polymorphic:01 constructors:01 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk In my experiences with ocaml, one of the major frustrations i constantly run into is the lack of subtyping. Polymorphic variants partially fix that problem, by allowing one to define types as immediate unions (i.e. without constructors) of other types, hence allowing a value to belong to both the subtype and the supertype, not to mention multiple unrelated types. However, there is still the issue of defining stuff such as "equality types", "comparables", and such, allowing overloading of functions on those. For example, when writing a large system with many datatypes, i tend to find myself commenting each type definition with stuff like "(*equality type*)", to indicate to myself whether or not im allowed to use the default = operator on that type(for example, a set type would not get that annotation). Haskell solves that problem through the use of type classes. Another problem i run into is the inability to define parametric higher order polymorphic types (is this the correct terminology?).. for example. lets say i want to define the following type: type 'a identifier = I of 'a *int | S of 'a*int but, what if i want to restrict 'a to a narrower class of types (as opposed to ad hoc types)... i would wish to say something like: type 'identifiable identifier = I of 'a*int | S of 'a*int where 'identifiable is a type class of some sort. I am not sure if Haskell solves this problem using type classes(seems like it could), Someone experienced in Haskell would probably know. I wonder if there are any plans to implement such a system in ocaml? if so, what approach would be taken? just a few thoughts..... ------------------- To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/ Beginner's list: http://groups.yahoo.com/group/ocaml_beginners