[squeak-dev] thisClass
Igor Stasenko
siguctua at gmail.com
Thu Jul 16 19:34:46 UTC 2009
2009/7/16 Eliot Miranda <eliot.miranda at gmail.com>:
> Hi All,
> in working on Cog I need the concept of "here class", the class of the
> current method. Analogous to super, where a lookup starts above the class
> of the current method, here class is the class of the current method. if
> you're for example collecting sets of selectors for translation to C then
> you need to talk about the selectors of this method's class, not the
> selectors of some subclass which may simply extend the base class a little.
> One clumsy implementation is the following
> thisContext method methodClass
> which one might use as in
> thisContext method methodClass theNonMetaClass selectors do: [:sel| ...
> Given this isn't important enough to change the language and add a new
> pseudo-variable such as hereClass I just want to add it to ContextPart, e.g.
> thisContext thisClass
> Anyone done this before, and if so what did you call it?
If you're want only to short-cut writing:
thisContext method methodClass
then why use other selector than methodClass?
Btw, in Pharo image (which i currently running) there is already such
thing, implemented as:
ContextPart>>methodClass
"Answer the class in which the receiver's method was found."
^self method methodClass ifNil:[self receiver class].
A method stamp reads:
md 2/17/2006 18:41 · debugger access
so it looks like it been there for a while.
> Anyone have strong opinions on the selector (not the technique; needs must
> when Slang drives)?
> Anyone have strong opinions on whether I add this as a kernel method or just
> keep it as a VMMaker extension?
> Best
> Eliot
>
>
>
--
Best regards,
Igor Stasenko AKA sig.
More information about the Squeak-dev
mailing list
|