[Pharo-dev] Instrumenting field accesses with Opal?

Camille Teruel camille.teruel at gmail.com
Wed Nov 13 08:54:52 EST 2013


On 13 nov. 2013, at 14:51, Marcus Denker <marcus.denker at inria.fr> wrote:

> 
> On 13 Nov 2013, at 14:44, Camillo Bruni <camillobruni at gmail.com> wrote:
> 
>> 
>> On 2013-11-13, at 14:42, Camille Teruel <camille.teruel at gmail.com> wrote:
>>> On 13 nov. 2013, at 14:21, Alexandre Bergel <alexandre.bergel at me.com> wrote:
>>> 
>>>> Hi!
>>>> 
>>>> Is there a way to get notified when fields are accessed?
>>>> That would be awesome
>>> 
>>> You can use the current reflectivity prototype. It's on RMoD CI: https://ci.inria.fr/rmod/job/Reflectivity/
>>> It should look like something like that:
>>> 
>>> YourClass methods do: [ :method |
>>> 	method ast 
>>> 		forAllNodes: [ :node | node isVariable and: [ node isInstance ] ]
>>> 		putAfter: [ RFMetalink expression: 'Transcript crShow: ''iv accessed''' ];
>>> 		installWrapper ].
>> 
>> In the end we should be able to just use the Slot MOP ;)
> 
> or put a link on the slot object instead of all the AST nodes of accesses.

Yes it will be more concise and high-level (even if behind the scenes, the same thing happens)
It will be for Pharo 4.0, an awesome release for sure :)

> 
> 	Marcus





More information about the Pharo-dev mailing list