Custom concept as a template node tree
I often have a need to define a concept that aggregates closure literal with predefined parameters, some statements in the body, but which have certain nodes that should be customized. In this case template is written on D-1 langauge, but itself belongs to a more abstract language D. A foobar example could be like this:
template base concept:
template itself:
template usage:
No need to provide special data flows, checking rules, reduction rules, etc.
Are there any future plans on implementing MPS feature alike?
template base concept:
/* Concept with Expression and SatementList blocks */ MyJDBCStatement * child Expression childCondition * child StatementList body
template itself:
/* Template with mounted shortcuts as references to MyJDBCSTatement children */ if(myconcept.condition1 && myconcept.ref.condition2 && :[concept.childCondition] { // mount condition expression Connection c = doGetConnection(); //throws SQLException :[concept.body] //mount body func1(); // throws bunch of exceptions })
template usage:
string foo = doSomeCalculations(); MyJDBCStatment{ childCondition -> foo.length()>5 body -> { System.out.println(foo); } };
No need to provide special data flows, checking rules, reduction rules, etc.
Are there any future plans on implementing MPS feature alike?
Please sign in to leave a comment.