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

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

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

Marcus Denker-4
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

Reply | Threaded
Open this post in threaded view
|

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

Ben Coman
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


Reply | Threaded
Open this post in threaded view
|

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

Marcus Denker-4

> On 22 Mar 2015, at 11:33, Ben Coman <[hidden email]> 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


Reply | Threaded
Open this post in threaded view
|

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

Marcus Denker-4

On 22 Mar 2015, at 11:41, Marcus Denker <[hidden email]> wrote:


On 22 Mar 2015, at 11:33, Ben Coman <[hidden email]> 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.


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

Reply | Threaded
Open this post in threaded view
|

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

Ben Coman


On Sun, Mar 22, 2015 at 9:24 PM, Marcus Denker <[hidden email]> wrote:

On 22 Mar 2015, at 11:41, Marcus Denker <[hidden email]> wrote:


On 22 Mar 2015, at 11:33, Ben Coman <[hidden email]> 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.


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
Reply | Threaded
Open this post in threaded view
|

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

Marcus Denker-4

I will revert the change in the visitor… this way we are sure that we do not get any problems.


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
Reply | Threaded
Open this post in threaded view
|

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

Tudor Girba-2
Indeed, it is an amazing piece of work :).

Doru

On Sun, Mar 22, 2015 at 2:58 PM, Marcus Denker <[hidden email]> wrote:

I will revert the change in the visitor… this way we are sure that we do not get any problems.


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



--

"Every thing has its own flow"
Reply | Threaded
Open this post in threaded view
|

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

Marcus Denker-4
In reply to this post by Marcus Denker-4
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


--