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: John Max Skaller <skaller@o...>
Subject: Re: Same label in different types, how do people solve this?
Pierre Weis wrote:

> 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

	This is logical .. but do we really need another operator?
The syntax is bloating beyond C++ :-)

	If some kind of overloading is being considered,
couldn't it apply to record labels too? I guess you'd have to use
a let/type .. and construction:

	let f x = x + x 
	and f x = x +. x
	in f 1, f 1.0

	type p2 = { x : int; y : int }
	and p3 = { x : int; y : int; z : int };;
	{ x=1; y = 2 };;

It seems unprincipled that the first case reports an error,
but in the second, the second 'x' hides the first.

-- 
John (Max) Skaller, mailto:skaller@maxtal.com.au
10/1 Toxteth Rd Glebe NSW 2037 Australia voice: 61-2-9660-0850
checkout Vyper http://Vyper.sourceforge.net
download Interscript http://Interscript.sourceforge.net