Hello everyone,
Reflectivity beta is out !
Reflectivity is a tool that permit to annotate AST nodes with "metalinks".
You can put metalinks at different "positions":
before: the metalink is executed before the node
instead: the metalink is executed instead the node
after: the metalink is executed after the node
onError: the metalink is executed only if the execution of the node raises an
error
onSuccess: the metalink is executed only if the execution of the node raises no
error
When you put metalinks on some node of a method's AST, a wrapper is installed
in place of the method. When executed, this wrapper compiles an expanded
version of the AST that takes metalinks into account and install the resulting
compiled method.
Examples:
increaseAllNumbersIn: aCompiledMethod
"A method that increases all numbers in aCompiledMethod"
aCompiledMethod reflectiveAST
forAllNodes: [ :node | node isLiteral and: [ node value
isNumber ] ]
putInstead: [ :node | RFMetalink fromExpression: (node value +
1) asString ].
removeMetalinksIn: aCompiledMethod
aCompiledMethod reflectiveAST removeAllMetalinks
In nautilus, you have a menu entry called 'Edit metalinks' that permit to edit
the metalinks of the node corresponding to the selected piece of code.
As an example use case, another entry called 'Put breakpoint' adds a metalink
that corresponds to 'Halt now' before the selected node.
Remember that it is a beta, so you might find errors and things are likely to
change.
You can load Reflectivity with:
Gofer it
smalltalkhubUser: 'RMoD' project: 'Reflectivity';
configuration;
loadDevelopment
Or you can download it from RMoD's CI:
https://ci.inria.fr/rmod/job/Reflectivity/
Camille