Also, I do not think metalinks could work on #write:to: method from slots, because that method is not used at runtime (I do not remember exactly but maybe somebody knows the details...).

 

Le 2019-04-03 16:20, Steven Costiou a écrit :

Hi,

if you are using Pharo7, you could do either on a class (affects all instances) or on an object (affects only the target instance):

classOrObject link: yourMetaLink toSlotNamed: #slotName option: #write

It will install the metalink on all write accesses to the slot.

Note that if you target a single object, it will be migrated to an anonymous subclass for the metalink to be object-specific.

 

In both cases, if you add or remove inst-var accesses, the metalink should update automatically.

 

Steven.

 

 

Le 2019-04-03 15:57, Vitor Medina Cruz a écrit :

Hello,

Is it possible to intercept a slot store? I tried with a before metalink into #write:to selector, but it don't seems to work. Should I use another selector?

I would like to experiment with ivar change notification, but I don't know what is the better approach. I know I could install a MetaLink in an attribution node, but that seems ankward and I would have to edit the linkage every time my object is changed, isn't true?

Regards,
Vitor