From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on yquem.inria.fr X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=AWL autolearn=disabled version=3.1.3 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 206F2BC0A for ; Wed, 28 Feb 2007 02:58:08 +0100 (CET) Received: from ipmail01.adl2.internode.on.net (ipmail01.adl2.internode.on.net [203.16.214.140]) by concorde.inria.fr (8.13.6/8.13.6) with ESMTP id l1S1w5HR024338 for ; Wed, 28 Feb 2007 02:58:06 +0100 Received: from ppp41-119.lns2.syd6.internode.on.net (HELO rosella) ([59.167.41.119]) by ipmail01.adl2.internode.on.net with ESMTP; 28 Feb 2007 12:28:02 +1030 Subject: Re: [Caml-list] Fwd: "ocaml_beginners"::[] Trouble combining polymorphic classes and polymorphic methods From: skaller To: Jacques Garrigue Cc: lukstafi@gmail.com, caml-list@inria.fr In-Reply-To: <20070228.103403.105433774.garrigue@math.nagoya-u.ac.jp> References: <301730110702271322m72d20cffh37bddb14dc91b6f9@mail.gmail.com> <20070228.092306.92341518.garrigue@math.nagoya-u.ac.jp> <4a708d20702271718r3fa74211jbf81372bc9fb8b79@mail.gmail.com> <20070228.103403.105433774.garrigue@math.nagoya-u.ac.jp> Content-Type: text/plain Date: Wed, 28 Feb 2007 12:57:56 +1100 Message-Id: <1172627876.19033.85.camel@rosella.wigram> Mime-Version: 1.0 X-Mailer: Evolution 2.6.1 Content-Transfer-Encoding: 7bit X-Miltered: at concorde with ID 45E4E1AD.000 by Joe's j-chkmail (http://j-chkmail . ensmp . fr)! X-Spam: no; 0.00; ocaml:01 polymorphism:01 compiler:01 sourceforge:01 polymorphic:01 polymorphic:01 beginners:01 wrote:01 caml-list:01 int:01 int:01 define:01 garrigue:03 confused:03 canonical:03 On Wed, 2007-02-28 at 10:34 +0900, Jacques Garrigue wrote: > and polymorphism. What some people do not like about structural types > is that they do not "brand" types: you can define the same type > elsewhere, possibly with a different intended meaning, and the > compiler will not distinguish between the two. Of course you CAN brand types if you want to! type 'a metres = Metres of 'a type 'a feet = Feet of 'a type int_metres = int metres type int_feet = int feet or perhaps type metres = { metre: int } type feets = { feet: int } or some other trick with phantom types I'm sure someone will point out. After all a nominal type is just a structural type with a unique tag representing its unique name. Look at in the converse: a structural type is just the canonical representative of nominal types with the same structure. Or perhaps i'm confused .. :) -- John Skaller Felix, successor to C++: http://felix.sf.net