Usage for Primitive Data Type Declaration

I'm working my way through learning MPS and am perplexed by the ability to create new Primitive Data Type Declarations in the structural aspect.

Can someone explain the benefit of these nodes? I see that I can make my new primitive the value type of an enum, but really don't understand where to go from there?

Where can I define the valid value options for my primitive? For example, for boolean, this would be {true, false}.

I've searched the documentation, but don't even see this structure mentioned in the user guide. Is it deprecated?

Thanks!
0
2 comments
Avatar
Permanently deleted user
Hey larrylebron!

According to @fabiencampagne 's book

The default MPS primitive data types can be extended by creating a new Primitive Data Type in a language.


You can restrict your type in the property constraints section and in the editor limit user input.
What's the real (huge) benefit is also in my interest.

Regards,
msch95
0
Avatar
Permanently deleted user
No, not deprecated. You can use your new primitive data types in the 'properties:' section of concept declarations. And having properties of data types that reflect the data used in the domain is a benefit. As you already noted you can define your enums or e.g. a data type for bank IBANs so that only valid IBAN strings were accepted.
1

Please sign in to leave a comment.