Difference between "Used" and "Extended" languages
Hi.
First of all - huge thanks for MPS product.
I have a couple of questions and first - what is a difference between "Used" and "Extended" languages property of a model?
Documentation says:
- Used language - if module A uses language L, then models inside A can use language L.
- Extended language - if language L extends language M, then every concept from M can be used inside L as a target of a role or extended concept. Also, all the aspects from language M are available for use and extension from the corresponding aspects in language L.
This is not completely clear for me. What other "uses" a language can have, except mentioned in second item? Could you please give some examples
Please sign in to leave a comment.
Hi!
Imagine you have language L and would like to create a "program" using this language. In this case you have to add L to a list of "used" languages in your model (a sort of "importing" language) and then you will be able to create desired language constructions from language L in this model. Example: you can add "jetbrains.mps.baseLanguage.collections" to a list of used languages in the model and then type something like:
On the other side if you are working on a language extension to a language L then you have to add L to a list of Extended Languages of your language (this is a language property, it's not available for the solution).
Example: in MPS calculator tutorial we propose adding jetbrains.mps.baseLanguage to a set of Extended Languages. Then in one of following steps you will be asked to modify OutputField concept in order to contain child element - Expression concept (concept from the base language).
So, there are two different levels of importing language
Thanks a lot, Alex! Very detailed answer.