Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
RE: 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: 2000-12-15 (12:58)
From: John Max Skaller <skaller@o...>
Subject: Re: Same label in different types, how do people solve this?
Mattias Waldau wrote:
> My problems isn't the restriction as such. If I know about the restriction,
> I can code around it.
> The problem is that this particular restriction is very unusual, and
> therefor I need to be informed about this. Now it is in the faq, but why not
> put it into the error message "two fields in different types in the same
> file/module cannot have the same name."

	It's not clear:

	open A (* contains field x *)
	open B (* contains field x *)

	expr.x (* B.x *)
	expr.A.x (* A.x *)
	expr.B.x (* B.x *)

Possibly, it is the _usage_ 'expr.x' which should be flagged
as erroneous, which would suggest:

	open List
	open Array
	map f [] 
	map f [| |]

both applications ought to be in error (rather than just map f []).
This would break a LOT of code I'd imagine, even if it is
'better principled' than the current scheme, which might lead to
confusing messages.

John (Max) Skaller,
10/1 Toxteth Rd Glebe NSW 2037 Australia voice: 61-2-9660-0850
checkout Vyper
download Interscript