Version française
Home     About     Download     Resources     Contact us    
Browse thread
Same label in different types, how do people solve this?
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Pierre Weis <Pierre.Weis@i...>
Subject: Re: Same label in different types, how do people solve this?
> 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

Best regards,

Pierre Weis

INRIA, Projet Cristal, Pierre.Weis@inria.fr, http://cristal.inria.fr/~weis/