[Pharo-users] How to intercept every instance variable write on all objects

Peter Uhnak i.uhnak at gmail.com
Sat Feb 2 09:48:28 EST 2019


Hi,

3) Metalinks - it's based on intercepting method calls, right? But I need
to intercept direct instance variable write, so probably not possible

no, you can attach metalink to any AST node, including an Assignment Node.
Some years ago I've made a small utility for this that also
auto-reinstalled when the method has changed.
Should work with P6, not sure about the current P7
https://github.com/peteruhnak/metalinks-toolkit .

But of course you can attach the MetaLink directly.

P


On Fri, Feb 1, 2019 at 12:43 AM Petr Fischer via Pharo-users <
pharo-users at lists.pharo.org> wrote:

> Hello,
>
> is possible to intercept (before writeú all instance variable writes on
> every existing objects?
>
> I found a discussion here:
>
> http://forum.world.st/Is-it-possible-to-follow-an-object-through-a-computation-td5092459.html
>
> Known solutions:
>
> 1) jugglery with object read only state + ModificationForbidden - not
> ideal, it's probably slow via exceptions and every nested on:do: stop
> change detection
>
> 2) it's possible to do it via slots - but it does not work on any existing
> object (only on my specially prepared objects with slots)
>
> 3) Metalinks - it's based on intercepting method calls, right? But I need
> to intercept direct instance variable write, so probably not possible
>
> Is there any way? Thanks! pf
>
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.pharo.org/pipermail/pharo-users_lists.pharo.org/attachments/20190202/69886cfe/attachment.html>


More information about the Pharo-users mailing list