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
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-14 (18:13)
From: John Max Skaller <skaller@o...>
Subject: Re: Same label in different types, how do people solve this?
Mattias Waldau wrote:
> Thanks for all the answers! Obviously this question including the
> suggestions should be in the FAQ.
> I understand that all you functional experts thinks this restriction is
> obvious, but for me it is more like a bug/misfeature. So this 'misfeature'
> should actually be stated for all us who aren't interested how types are
> infered in functional programming.
> I actually thought there was a simple work-around, but there isn't.

This isn't unique to 'functional' languages.

	enum X {a,b,c};
	enum Y {a,b}; // Woops!

The C++ solution is the same as the Ocaml one: wrapping:

	struct XX { enum X {a,b,c
}; };
	struct YY { enum Y {a,b}; };

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