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 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? 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
|
> 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? > 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 > > I believe it should be a kernel method. Cheers, Juan Vuletich |
In reply to this post by Eliot Miranda-2
2009/7/16 Eliot Miranda <[hidden email]>:
> 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. |
On Thu, Jul 16, 2009 at 12:34 PM, Igor Stasenko <[hidden email]> wrote: 2009/7/16 Eliot Miranda <[hidden email]>: Good. methodClass it is. Thanks!
|
Free forum by Nabble | Edit this page |