[Reflectivity] simple #before and #after links working...
Hi, After loading this: https://pharo.fogbugz.com/f/cases/15196/Simple-before-and-after-links-with-m... <https://pharo.fogbugz.com/f/cases/15196/Simple-before-and-after-links-with-m...> 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
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 <marcus.denker@inria.fr> wrote:
Hi,
After loading this:
https://pharo.fogbugz.com/f/cases/15196/Simple-before-and-after-links-with-m...
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
On 22 Mar 2015, at 11:33, Ben Coman <btc@openInWorld.com> wrote:
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.
Yes, maybe we should postpone it⦠releasing is boring, I have to admit :-) Marcus
On 22 Mar 2015, at 11:41, Marcus Denker <marcus.denker@inria.fr> wrote:
On 22 Mar 2015, at 11:33, Ben Coman <btc@openInWorld.com> wrote:
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.
Yes, maybe we should postpone it⦠releasing is boring, I have to admit :-)
I will revert the change in the visitor⦠this way we are sure that we do not get any problems. https://pharo.fogbugz.com/f/cases/15207/Undo-compiler-change-from-case-15196 <https://pharo.fogbugz.com/f/cases/15207/Undo-compiler-change-from-case-15196> I am really looking forward to that in Pharo5⦠it is (one of my) largest mistakes that after my PhD I did not focus on getting Reflectivity into Pharo⦠it is still amazing, even 5 years later, I think. (but I am biased ;-) Marcus
On Sun, Mar 22, 2015 at 9:24 PM, Marcus Denker <marcus.denker@inria.fr> wrote:
On 22 Mar 2015, at 11:41, Marcus Denker <marcus.denker@inria.fr> wrote:
On 22 Mar 2015, at 11:33, Ben Coman <btc@openInWorld.com> wrote:
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.
Yes, maybe we should postpone it⦠releasing is boring, I have to admit :-)
I will revert the change in the visitor⦠this way we are sure that we do not get any problems.
https://pharo.fogbugz.com/f/cases/15207/Undo-compiler-change-from-case-15196
I am really looking forward to that in Pharo5⦠it is (one of my) largest mistakes that after my PhD I did not focus on getting Reflectivity into Pharo⦠it is still amazing, even 5 years later, I think. (but I am biased ;-)
Marcus
Thanks Marcus. It sets a good example for everyone (including me). Anyway, its a nice bit of honey to draw more people to follow the Pharo 5 trunk ;) cheers -ben
I will revert the change in the visitor⦠this way we are sure that we do not get any problems.
https://pharo.fogbugz.com/f/cases/15207/Undo-compiler-change-from-case-15196 <https://pharo.fogbugz.com/f/cases/15207/Undo-compiler-change-from-case-15196>
I am really looking forward to that in Pharo5⦠it is (one of my) largest mistakes that after my PhD I did not focus on getting Reflectivity into Pharo⦠it is still amazing, even 5 years later, I think. (but I am biased ;-)
Marcus
Thanks Marcus. It sets a good example for everyone (including me). Anyway, its a nice bit of honey to draw more people to follow the Pharo 5 trunk ;) cheers -ben
I will be so great that nobody will use Pharo4 ever⦠;-) Marcus
Indeed, it is an amazing piece of work :). Doru On Sun, Mar 22, 2015 at 2:58 PM, Marcus Denker <marcus.denker@inria.fr> wrote:
I will revert the change in the visitor⦠this way we are sure that we do not get any problems.
https://pharo.fogbugz.com/f/cases/15207/Undo-compiler-change-from-case-15196
I am really looking forward to that in Pharo5⦠it is (one of my) largest mistakes that after my PhD I did not focus on getting Reflectivity into Pharo⦠it is still amazing, even 5 years later, I think. (but I am biased ;-)
Marcus
Thanks Marcus. It sets a good example for everyone (including me). Anyway, its a nice bit of honey to draw more people to follow the Pharo 5 trunk ;) cheers -ben
I will be so great that nobody will use Pharo4 ever⦠;-)
Marcus
-- www.tudorgirba.com "Every thing has its own flow"
This is now back in 5.0 #005
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
-- Marcus Denker -- denker@acm.org http://www.marcusdenker.de
participants (3)
-
Ben Coman -
Marcus Denker -
Tudor Girba