Re: [Pharo-dev] Reflectivity beta
On 31 mai 2013, at 11:16, Pavel Krivanek wrote: > Really cool! Has anyone already tried to build coverage tests based on it? Not yet, that's brand new stuff so nobody did anything with it. > -- Pavel > > On Thu, May 30, 2013 at 6:15 PM, Camille Teruel > wrote: > 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 >
Re: [Pharo-dev] Reflectivity beta
Really cool! Has anyone already tried to build coverage tests based on it? -- Pavel On Thu, May 30, 2013 at 6:15 PM, Camille Teruel wrote: > 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 >
Re: [Pharo-dev] Reflectivity beta
> I would love to have an editor where you manipulates ast nodes directly. Me too. And we got killed by the state of the Scanner. Old infrastructure always bite us hard. We ask gisela to check with PetitParser and sync with Camillo/Damien/"Lukas"/Guillaume for the introduction of error handling in PetitParser. Stef
Re: [Pharo-dev] Reflectivity beta
Am 31.05.2013 um 09:48 schrieb Marcus Denker : > > On May 31, 2013, at 9:04 AM, Norbert Hartl wrote: > >> Sounds great! What happens if a method is recompiled. All metalinks are gone >> then? >> > > Yes, because they have no semantic knowledge other than the AST node. > > Starting to match trees to put back links is difficult *and* does not work > really, either. > > E.g if I put a link > on > self foo. > > and then add a second > self foo. > > just in front, where will the retained link be? > > And them, the new method could be completely different. Maybe the user > putting the link did not want it > on all sends called foo, but on all self sends? No way to tell… they just do > not carry the intention of the developer. > For that one needs higher levels to take care. > > The idea is that the links are low-level, you always use them in a managed > way. E.g. a line-based > breakpoint would be manage by the debugger, the links in an AOP system would > be managed by the > PointCut (which declaratively specifies where to put links). Edit method --> > level above puts links again. > > In the *long* term I want Pharo to not manipulate text but ASTs directly, in > this case it is easy to maintain the > links as the AST does not change. But this is Pharo5 or so ;-) > But even that does not remove then need of higher levels. Because if the user > put links on all ivar accesses, the > code I add will not magically have those links even in this case, because the > existing do not encode the intention > "I want links on all Ivar access". I don't think that editing the AST directly solves this problems. You can always remove things in a way so that bringing them back makes you loose the meta information. But then it maybe is not necessary to put something like that as a AST feature. If I programmatically annotate AST nodes I will have some code that does it. Then I only need to know when some method has changed and I can reapply the annotations/metalinks. To preserve exisiting metalinks I would have to know before and after a method has changed so I'm able to reapply the exact same thing there. Besides Announcements I could add metalinks to the compiler that triggers my code to manage metalinks of my code. There is always a way to go meta. Wonderful! Time for me to make my first 3.0 tests :) Norbert
Re: [Pharo-dev] Reflectivity beta
Indeed, this would be fantastic :) Doru On Fri, May 31, 2013 at 9:45 AM, Camille Teruel 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 : > > 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"
Re: [Pharo-dev] Reflectivity beta
On May 31, 2013, at 9:04 AM, Norbert Hartl wrote: > Sounds great! What happens if a method is recompiled. All metalinks are gone > then? > Yes, because they have no semantic knowledge other than the AST node. Starting to match trees to put back links is difficult *and* does not work really, either. E.g if I put a link on self foo. and then add a second self foo. just in front, where will the retained link be? And them, the new method could be completely different. Maybe the user putting the link did not want it on all sends called foo, but on all self sends? No way to tell… they just do not carry the intention of the developer. For that one needs higher levels to take care. The idea is that the links are low-level, you always use them in a managed way. E.g. a line-based breakpoint would be manage by the debugger, the links in an AOP system would be managed by the PointCut (which declaratively specifies where to put links). Edit method --> level above puts links again. In the *long* term I want Pharo to not manipulate text but ASTs directly, in this case it is easy to maintain the links as the AST does not change. But this is Pharo5 or so ;-) But even that does not remove then need of higher levels. Because if the user put links on all ivar accesses, the code I add will not magically have those links even in this case, because the existing do not encode the intention "I want links on all Ivar access". Marcus
Re: [Pharo-dev] Reflectivity beta
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 : > >> 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
Re: [Pharo-dev] Reflectivity beta
Sounds great! What happens if a method is recompiled. All metalinks are gone then? Norbert Am 30.05.2013 um 18:15 schrieb Camille Teruel : > 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
Re: [Pharo-dev] Reflectivity beta
On May 31, 2013, at 8:05 AM, Denis Kudriashov wrote: > Amazing! > Pharo 3.0 will be another big step forward > Yes! This is starting to be a lot of fun… :-) Marcus
Re: [Pharo-dev] Reflectivity beta
On 31 mai 2013, at 07:42, Clément Bera wrote: > This is impressive ! > > Does it work with Opal only or also with the old Compiler ? It compiles with Opal. Opal also need to be the default compiler if you want to debug the generated methods. > > > 2013/5/30 Camille Teruel > 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 > > > > -- > Clément Béra > Mate Virtual Machine Engineer > Bâtiment B 40, avenue Halley 59650 Villeneuve d'Ascq
Re: [Pharo-dev] Reflectivity beta
Amazing! Pharo 3.0 will be another big step forward 2013/5/30 Camille Teruel > 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 >
Re: [Pharo-dev] Reflectivity beta
This is impressive ! Does it work with Opal only or also with the old Compiler ? 2013/5/30 Camille Teruel > 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 > -- Clément Béra Mate Virtual Machine Engineer Bâtiment B 40, avenue Halley 59650 *Villeneuve d'Ascq*
[Pharo-dev] Reflectivity beta
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