MPS 2020.3 Early Access Program V1

Oscar Rodriguez

We have begun our new Early Access Program for MPS 2020.3. Throughout this program we will focus on building stable new features for MPS 2020.3. Let’s take a look at the new functionality we prepared.


DOWNLOAD MPS 2020.3 EAP1

Improved root annotation in VCS

The old root annotation algorithm used the results of the annotation obtained from the model text file. It worked for text-persisted models only and was not quite correct in the majority of cases. With the new approach, the annotation is constructed by comparing the models from different revisions.

Error strip on project pane

We are introducing a new way to display errors, warnings, and messages in the Project pane. The Error strip helps to organize the messages on the Project pane. You can deactivate it via the Logical View setting button.

New generator macro

There’s a new macro named $CALL-SITE$ that facilitates the insertion of a node attributed with a SWITCH/CALL macro into a designated place in the invoked template. Prior to the change, the template node with a SWITCH/CALL macro attached was generally ignored. Now if an invoked template/switch tries to use ‘call site node’, the node is processed as a regular template and the outcome is supplied to the invoked template/switch as an implicit argument that can be inserted into the desired location.

Here we see the invocation of the reduce_Comment template serving as a ‘call site’ for the reduce_MethodDeclaration template:

If we take a look into the template, there’s a supplied call site node with a $CALL-SITE$ statement in the method body:

There’s also now an invocation of the reduce_Expressions switch, parameterized with a template node (trace method call) with a property macro and reference macro (that makes the method call point to a proper method declaration elsewhere). Inside the switch, $CALL-SITE$ replaces a placeholder method call with the one that comes as a ‘call site node’:

Template and Switch declarations have a flag, which is toggled by intention, that indicates that it would like to use the call site node. It’s an error to use the $CALL-SITE$ macro inside a template/switch that didn’t flag the need to get $CALL-SITE$. There’s no need to specify an explicit argument in CALL/SWITCH – the MPS generator can tell if the template/switch being invoked needs a call site and further evaluates the template, including the macros, of CALL/SWITCH prior to processing it.

This functionality comes in handy in scenarios like conditional type casts the

IF needCast (Type) expression ELSE expression or conversions when there are multiple sources of expression that may serve as an input such as switch { case Double : Double.valueOf(expression); case Integer : Integer.valueOf(expression, 16); …}, and it’s therefore impractical to have a dedicated switch/template for each case.
 
Together with this new functionality, we have also fixed a bunch of bugs. Try this version and please report any issues you encounter in our issue tracker.
 

Stay safe and have a great day!

Your JetBrains MPS team

The Drive to Develop

blog_footer_bw@2x

Subscribe

Subscribe for updates