Initialize editor for abstract concept with an editor for one of its concrete subconcepts

I have an abstract concept `Rational` for rational numbers. It has two concrete subconcepts, `Decimal` and `Fraction`, which represent two ways of entering rational numbers. I have defined editors for the concrete subconcepts. Now wherever editor for `Rational` is needed, I would like to always start with an editor for `Decimal`. (`Fraction` editor will be reachable by e.g. hitting '/' in the `Decimal` editor.) How would I instruct MPS to use `Decimal` as the default editor for `Rational`?


In Constraints for Rational you can specify the default concrete sub-concept to use, whenever the abstract concept of Rational is about to be instantiated.


That works, thank you!


Turns out that this solution does not work for a `Rational` of cardinality [0..1].


It should and does for me. Maybe something else in your language definition has changed?


Strictly speaking, it does work, but only after the editor for the optional value is instantiated, that is, after first hitting Enter in the placeholder. I guess, after all, this makes sense and is good enough.

In these screenshots, endpoint coordinates are Rationals of cardinality 1, whereas thickness is Rational of cardinality 0..1:

I can start typing numbers for a coordinate into the <no value> placeholder right away, since it is already an editor for Decimal. That's not the case for thickness:

It first needs to be instantiated by hitting Enter - then it turns into an editor for Decimal:

at which point I can start typing in numbers.


A custom transformation action would need to be defined in order to instantiate a specific concept as a reaction to typing numeric values.


Please sign in to leave a comment.