Enummember typing mystery
Let's create a new language under MPS. The language will be very simple and will contain:
1. concept named "Apple"
2. enumeration named "Color"
MPS source code goes below:
Now the funny part comes. I am adding "behavior" to the concept Apple:
This method will not compile (!)
I browsed all the documentation, all examples and tutorials but was unable to understand what I am doing wrong. According to the "User's manual" the types are correct.
Please help :-)
I use build #MPS-135.1462
Regards
Wojtek
1. concept named "Apple"
2. enumeration named "Color"
MPS source code goes below:
enumeration datatype Color
member type : string
no default : false
default : <1-st member>
member identifier : derive from presentation
value <NULL> presentation red (default)
value <NULL> presentation green
value <NULL> presentation yellow
concept Apple extends BaseConcept
implements <none>
instance can be root: false
alias: <no alias>
short description: <no short description>
properties:
color: Color
children:
<< ... >>
references:
<< ... >>
Now the funny part comes. I am adding "behavior" to the concept Apple:
concept behavior Apple {
constructor {
<no statements>
}
public enummember<Color> getTheColor() {
return this.color;
}
This method will not compile (!)
I browsed all the documentation, all examples and tutorials but was unable to understand what I am doing wrong. According to the "User's manual" the types are correct.
Please help :-)
I use build #MPS-135.1462
Regards
Wojtek
Please sign in to leave a comment.
You may use the MPS 3.2 doc, which has made improvements in covering enums - https://confluence.jetbrains.com/display/MPSD32/Structure
Copy-paste from MPS should, however, work reasonably well for most cases, in my experience. E.g.: