Working with Enumeration Datatypes
I'm using Enumeration Datatypes in my language. But I haven't found a good way to work with them.
If I define a property of an enumeration type, I just can access to it as a string. The is(< >) operation is just available if have direct access to that property. When I pass the property to a method it's just an ordinary string. And I haven't found a way to apply a switch case statement to the property.
I have found the type enummember<> and the operation enum/ /., which allow some enum handling but produces very much code for some primitive operations. Using these constructs lead to the confusing fact that enumerations differ between values and presentation (named name outside the declaration). I have found out that the value of a property handled as string is (mostly but not always!) the presentation. So what are the values for??
At the moment I would really prefer standard java enumerations, but I haven't fond a way to use them in my language structure.
If I define a property of an enumeration type, I just can access to it as a string. The is(< >) operation is just available if have direct access to that property. When I pass the property to a method it's just an ordinary string. And I haven't found a way to apply a switch case statement to the property.
I have found the type enummember<> and the operation enum/ /., which allow some enum handling but produces very much code for some primitive operations. Using these constructs lead to the confusing fact that enumerations differ between values and presentation (named name outside the declaration). I have found out that the value of a property handled as string is (mostly but not always!) the presentation. So what are the values for??
At the moment I would really prefer standard java enumerations, but I haven't fond a way to use them in my language structure.
Please sign in to leave a comment.
So enum/EnumDatatype/.<VAL> produces a enummember, but I haven't found a way to assign this directly to the property. This is inconvenient and error-prone.
I guess there is a better way. So please feel free to show me one ;)
node.enumproperty.set()
and
node.enumproperty.is() (for comparison)
Greets
Could you post a screenshot so I can understand how you use the enums?
Are you talking about enums in the baselang or the mps.lang(for language specification)?
Greets