Idiom for thisContext method with full blocks?

Previous Topic Next Topic
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

Idiom for thisContext method with full blocks?

Eliot Miranda-2
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

    ^self subclassResponsibility


    ^self outerCode homeMethod

    ^method homeMethod

    ^outerContext homeMethod

best, Eliot