Indeed, this would be fantastic :) Doru On Fri, May 31, 2013 at 9:45 AM, Camille Teruel <camille.teruel@gmail.com>wrote:
On 31 mai 2013, at 09:03, Norbert Hartl wrote:
Sounds great! What happens if a method is recompiled. All metalinks are gone then?
Yes indeed. If you have the method: foo self bar with a metalink on the message node and you recompile it to: foo self qux; bar; bar.
then it is hard to tell which node(s) should adopt the metalink because there is no way to tell which #bar message of the second version is the one from the first version. I would love to have an editor where you manipulates ast nodes directly. With such an editor the developer would have feedback of where the metalinks are. In the underlying model, AST nodes would have an equivalence relation to say whether two nodes are different versions the same or not. This model could also be really useful for versioning and diff too.
Norbert
Am 30.05.2013 um 18:15 schrieb Camille Teruel <camille.teruel@gmail.com>:
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
-- www.tudorgirba.com "Every thing has its own flow"