Here we introduce some handy BaseLanguage extensions
A Checked Dot Expression is an dot expression extended with null checks on the operand.
If the operand is null, the value of the whole checked dot expression becomes null, otherwise it evaluates to the value of corresponding dot expression.
Ways to create a Checked Dot Expression
The Make dot expression checked intention
Enter "?" after dot, e.g. customer.?address.?street
Left transform of operation with "?"
You can transform checked dot expressions to the usual dot expressions using the Make dot expression not checked intention
This language provides a way to overload binary operators.
Overloaded operator declarations are stored in an OverloadedOperatorContainer.
If there are several overloaded versions for one operator the most relevant is chosen.
Note that if an overloaded operators' usage is in the other model than its declaration, overloadedOperators language should be added to "languages engaged on generation" of usage's model.
Overloading plus operator for class Complex:
Also, you can define your own custom operators. Assume we want to create a binary boolean operator for strings, which tells if one string contains another:
Now, we can simply use this operator:
Custom constructors provide a simple way to create complex objects. They are stored in a special root node - CustomConstructorsContainer.
Assume we need a faster way to create rectangle.
Now, let's create a rectangle: