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 QAA22117 for caml-red; Mon, 11 Dec 2000 16:07:42 +0100 (MET) 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 KAA23177 for ; Fri, 8 Dec 2000 10:39:11 +0100 (MET) Received: from dpt-info.u-strasbg.fr (dpt-info.u-strasbg.fr [130.79.6.1]) by concorde.inria.fr (8.11.1/8.10.0) with ESMTP id eB89dAr01227; Fri, 8 Dec 2000 10:39:10 +0100 (MET) Received: from lambda.u-strasbg.fr (lambda.u-strasbg.fr [130.79.90.63]) by dpt-info.u-strasbg.fr (8.9.3/8.9.3) with ESMTP id KAA19519; Fri, 8 Dec 2000 10:38:24 +0100 Received: from luther by lambda.u-strasbg.fr with local (Exim 3.16 #1 (Debian)) id 144K8O-0000CJ-00; Fri, 08 Dec 2000 10:48:08 +0100 Date: Fri, 8 Dec 2000 10:48:08 +0100 To: Pierre Weis Cc: Sven LUTHER , caml-list@inria.fr Subject: Re: Same label in different types, how do people solve this? Message-ID: <20001208104808.A753@lambda.u-strasbg.fr> References: <20001208103125.A556@lambda.u-strasbg.fr> <200012080936.KAA10930@pauillac.inria.fr> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i In-Reply-To: <200012080936.KAA10930@pauillac.inria.fr>; from Pierre.Weis@inria.fr on Fri, Dec 08, 2000 at 10:36:44AM +0100 From: Sven LUTHER Sender: weis@pauillac.inria.fr On Fri, Dec 08, 2000 at 10:36:44AM +0100, Pierre Weis wrote: > > Another idea would be to add some construct to use something like : > > > > type p3d = { x:float;y:float;z:float } > > type p2d = { x:float;y:float } > > > > and then be able to do : > > > > {p3d.x=10.;p3d.y=20.;p3d.z=30.} > > > > and > > > > {p2d.x=0; p2d.y=5} > > > > Would this be difficult to do ? > > You will have ambiguities in accessing records: what means r.y.z ? Is > it access to field z of type y of r, or access to field z of access to > field y of r ? > > I would suggest another syntactic notation to specify the type to > which a label belongs: label@@type. > > {x@@p2d = 0; y = 5} > r.x@@p2d Yes, didn't think about it, but that would be best. (too bad there is not a third kind of case to do the same kind of trick that is done with modules ...) Friendly, Sven Luther