Login  Register

Re: [Reflectivity] simple #before and #after links working...

Posted by Ben Coman on Mar 22, 2015; 10:23am
URL: https://forum.world.st/Reflectivity-simple-before-and-after-links-working-tp4813893p4814016.html

That is very cool. But I need to ask the tough question - given that the feature freeze was three weeks ago, what do we gain by adding this in Pharo 4?  

* Is it needed for demonstrations that won't be based off latest features in Pharo 5 ?

* Are third party libraries expected to be based only off Pharo 4 MetaLink features, rather than additional MetaLink features it sounds like Pharo 5 will get ?

> which means this slice should not impact anything

Because "should" being the operative word... is a slippery slope. If we have a philosophy of freezing features before a Release, then we should have the discipline to hold to that - at least in last 7 days before Release.

cheers -ben


On Sat, Mar 21, 2015 at 11:56 PM, Marcus Denker <[hidden email]> wrote:
Hi,

After loading this:


Simple after and before MetaLinks are taken into account, with just one check in #visitNode of the ASTTranslator that is
false when no links are there. (which means this slice should not impact anything)

For now this is for very simple MetaLinks: no parameters, no condition, no reification, no #instead/around, 
no meta-level modelling.

Here is a trivial example:

1) get a AST node from our example method:

sendNode := (ReflectivityExamples>>#exampleMethod) ast body statements first value.

2) then we define a link that is just #halt:

link := MetaLink new 
metaObject: Halt;
 selector: #now.

3) we set it:

sendNode link: link.

4) when we now execute the method, we get a halt:

ReflectivityExamples new exampleMethod

5) to get rid of it, uninstall the link:

link uninstall.

If you look at the byte code, you see that it compiles the link to the code:

25 <20> pushConstant: Halt
26 <D1> send: now

Marcus