[Vm-dev] Idiom for thisContext method with full blocks?
Eliot Miranda
eliot.miranda at gmail.com
Tue Jan 2 01:23:03 UTC 2018
Hi Clément,
I've written code like this:
(atEachStepBlock isNil or: [atEachStepBlock method ~~ thisContext
method]) ifTrue:
[...
where the intent is to see if a block is the one created by the current
method or not. This won't work for full blocks. But at least in my Squeak
code and the Pharo7 image as of today there's no accessor for the "home
method" yet. I expect we should be able to write
(atEachStepBlock isNil or: [atEachStepBlock homeMethod ~~
thisContext homeMethod]) ifTrue:
[...
where homeMethod is defined as
CompiledCode>>homeMethod
^self subclassResponsibility
CompiledMethod>>homeMethod
^self
CompiledBlock>>homeMethod
^self outerCode homeMethod
Context>>homeMethod
^method homeMethod
BlockClosure>>homeMethod
^outerContext homeMethod
_,,,^..^,,,_
best, Eliot
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/vm-dev/attachments/20180101/15bd25f1/attachment.html>
More information about the Vm-dev
mailing list