> On 27 Feb 2015, at 23:11, Thierry Goubier <[email protected]> wrote:
> 
> Le 27/02/2015 20:26, Marcus Denker a écrit :
>> 
>>> On 27 Feb 2015, at 19:48, Thierry Goubier <[email protected]> wrote:
>>> 
>>> Hi Markus,
>>> 
>>> if I understand correctly some of the possibilities:
>>> 
>>> - I can use RBParseTreeSearcher / RBParseTreeRewriter on the twin AST.
>>> 
>>> (any example how to install / invalidate the twin AST after an effective 
>>> RBParseTreeRewriter operation?)
>>> 
>> Yes, but I would do it on a copy… that is, do the change in run:with:in: on 
>> a copy, generate code from that,
>> keep the original.
>> An AST that follows the text is kind of nice for e.g. navigation.
>> 
>>> - Any change to the Twin AST is reflected in the method bytecode (as long 
>>> as one does invalidate).
>>> 
>> yes.
>> 
>>> This would mean being able to put tracing code with RB patterns, no? And 
>>> without having to do a recompilation of the traced method?
>>> 
>> 
>> Yes. At first I want to have something simple: a MOP based on the MetaLinks. 
>> But one could do the same with RB transformations:
>> put them as annotation on the method, then on recompile take them into 
>> account.
> 
> Maybe I'm not understanding everything, so would that be correct:
> 
> - If I inject additional behavior with meta-links, then they just annotate 
> the AST and do not really change it.
> 
> Now, since writing dedicated ast visitors takes quite some code, what could 
> work is to have a RBParseTreeMetaWriter: use a RB pattern to find the right 
> ast node, and add whatever meta-link there.
> 
Yes. The experiment right now does not use the rewriter, but we should have a 
look.

        Marcus


Reply via email to