To MPS devs: Refactoring BaseLanguage suggestion...

For my project, I needed to do some automatic manipulating and displaying of Expressions.  In particular, I would get the textual representation of an Expression, and sometimes I would "simplify" some of them (not in place, only for displaying purposes).  I found that this simplifying step came across some inconsistencies in the getCompileTimeConstantValue code (where it got modules from, and whether it was null safe), and the Displaying required me to basically copy and paste the existing ExpressionPresentationUtil class, and patch it with special cases.  

So, my proposal (and I realize this is a big change), is to make those behaviors aspect oriented.  So instead of having a "isConstantValue" or "getCompileTimeConstantValue" methods on the Concepts, you'd have some other extensible mechanism to look up instances of "ConstantValueChecker" classes, "ConstantValueCalculator" classes, and "ForDisplay" classes.

Ideally, any language designer extending baseLanguage could add new instances to that lookup mechanism, and override the results depending on context. 

I really like how you guys have made so much of this system aspect oriented. I'd just like to see it keep moving that way.

 

2 comments

I might have misunderstood, but this to me looks like a call for an interpreter, right? Maybe the one from MPS extensions could be utilized to interpret BaseLanguage code, at some point.

Vaclav

 

0

Vaclav, thanks for your response.

While what I proposed would be a good basis for an interpreter of BL, my suggestion is a bit more abstract.  Also, my use-case isn't really about interpreting BL, but manipulating expressions in specific ways (primarily for presentation purposes).

In any case, I have my own work-around for now, but I was just wanted to make the suggestion, as I believe it would make the architecture of BL more extensible.

0

Please sign in to leave a comment.