Browse thread
Same label in different types, how do people solve this?
[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: | 2000-12-11 (15:07) |
From: | Sven LUTHER <luther@d...> |
Subject: | Re: Same label in different types, how do people solve this? |
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