[Reflectivity] Links on Slots
Hi, basis for annotating instanceVariables (Slots) with meta links is now working. https://pharo.fogbugz.com/f/cases/16669/MetaLinks-on-Slots This test is green: testReifySlotName | iVar instance link | iVar := ReflectivityExamples slotNamed: #ivar. link := MetaLink new metaObject: self; selector: #tagExec:; arguments: #(name). iVar link: link. self assert: iVar hasMetalink. self assert: (ReflectivityExamples >> #exampleIvarRead) class = ReflectiveMethod. self assert: (tag isNil). instance := ReflectivityExamples new. self assert: (instance exampleIvarRead = 33). self assert: (tag = #ivar). link uninstall.
Yuppee! This means that we can now implement an inspector refresh properly, right? Cheers, Doru On Wed, Sep 30, 2015 at 11:49 AM, Marcus Denker <marcus.denker@inria.fr> wrote:
Hi,
basis for annotating instanceVariables (Slots) with meta links is now working. https://pharo.fogbugz.com/f/cases/16669/MetaLinks-on-Slots
This test is green:
testReifySlotName | iVar instance link | iVar := ReflectivityExamples slotNamed: #ivar.
link := MetaLink new metaObject: self; selector: #tagExec:; arguments: #(name).
iVar link: link. self assert: iVar hasMetalink. self assert: (ReflectivityExamples >> #exampleIvarRead) class = ReflectiveMethod. self assert: (tag isNil). instance := ReflectivityExamples new. self assert: (instance exampleIvarRead = 33). self assert: (tag = #ivar). link uninstall.
-- www.tudorgirba.com "Every thing has its own flow"
On 30 Sep 2015, at 17:23, Tudor Girba <tudor@tudorgirba.com> wrote:
Yuppee! This means that we can now implement an inspector refresh properly, right?
The only problem is that the change is only active for new method invocations⦠so there might be cases where it would not update if the change is done in a loop, for example, and active on the stack alreadyâ¦
Cheers, Doru
On Wed, Sep 30, 2015 at 11:49 AM, Marcus Denker <marcus.denker@inria.fr <mailto:marcus.denker@inria.fr>> wrote: Hi,
basis for annotating instanceVariables (Slots) with meta links is now working. https://pharo.fogbugz.com/f/cases/16669/MetaLinks-on-Slots <https://pharo.fogbugz.com/f/cases/16669/MetaLinks-on-Slots>
This test is green:
testReifySlotName | iVar instance link | iVar := ReflectivityExamples slotNamed: #ivar.
link := MetaLink new metaObject: self; selector: #tagExec:; arguments: #(name).
iVar link: link. self assert: iVar hasMetalink. self assert: (ReflectivityExamples >> #exampleIvarRead) class = ReflectiveMethod. self assert: (tag isNil). instance := ReflectivityExamples new. self assert: (instance exampleIvarRead = 33). self assert: (tag = #ivar). link uninstall.
-- www.tudorgirba.com <http://www.tudorgirba.com/>
"Every thing has its own flow"
Hi, I think this should be Ok for most inspector cases because we rarely open the object in the middle of a method and expect it to be updated within that same method. Or did I get it wrong? Cheers, Doru On Wed, Sep 30, 2015 at 5:31 PM, Marcus Denker <marcus.denker@inria.fr> wrote:
On 30 Sep 2015, at 17:23, Tudor Girba <tudor@tudorgirba.com> wrote:
Yuppee! This means that we can now implement an inspector refresh properly, right?
The only problem is that the change is only active for new method invocations⦠so there might be cases where it would not update if the change is done in a loop, for example, and active on the stack alreadyâ¦
Cheers, Doru
On Wed, Sep 30, 2015 at 11:49 AM, Marcus Denker <marcus.denker@inria.fr> wrote:
Hi,
basis for annotating instanceVariables (Slots) with meta links is now working. https://pharo.fogbugz.com/f/cases/16669/MetaLinks-on-Slots
This test is green:
testReifySlotName | iVar instance link | iVar := ReflectivityExamples slotNamed: #ivar.
link := MetaLink new metaObject: self; selector: #tagExec:; arguments: #(name).
iVar link: link. self assert: iVar hasMetalink. self assert: (ReflectivityExamples >> #exampleIvarRead) class = ReflectiveMethod. self assert: (tag isNil). instance := ReflectivityExamples new. self assert: (instance exampleIvarRead = 33). self assert: (tag = #ivar). link uninstall.
-- www.tudorgirba.com
"Every thing has its own flow"
-- www.tudorgirba.com "Every thing has its own flow"
On 30 Sep 2015, at 17:45, Tudor Girba <tudor@tudorgirba.com> wrote:
Hi,
I think this should be Ok for most inspector cases because we rarely open the object in the middle of a method and expect it to be updated within that same method. Or did I get it wrong?
if you want to do change tracking by interception all writes, than any update in a loop (that accesses the ivar directly) that is active already before the inspector is opened would be not seen. I do not think this happens often. Possible solutions: - detect this case âthere is method on the stack accessing this ivar â> do slow update, or display a warning that automatic update might not work) - Implement on-stack replacement for e.g. just #before links⦠- use another mechanism to detect state change Marcus
participants (2)
-
Marcus Denker -
Tudor Girba