From: Nicolas C. <war...@fr...> - 2004-05-06 09:58:23
|
> I'd like to reconsider the iteration semantics of Enums. > So this is a thought experiment. [...] Sorry I didn't have time recently to answer the private talks we had about Enums specifications. My thinking is the following : Enum need more specification, but I want to keep them simple and unified. As you told, the only "good" way to have several types of enum is to use objects. I'm against it, simply because in stacked lazy operations such as map or filter, method lookup and call overhead is simply to high for something such as an enum. I'm trying to think about a solution is polymorphic variants in order to allow/restrict some operations on enums, and still have one type as well as the type system compilation checks. For example , an enum which have a count enum could be a : type 'a countable_enum = ([> 'Count ] ,'a) enum val count : countable_enum -> int (and so on...) However , I didn't experiment the idea in details yet. Regards, Nicolas Cannasse |