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?
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.
Consider:

	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, 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