Try using
.context~stackFrames[1]~type
Which will return a string indicating the type of that stackFrame.
Rick
On Mon, Feb 13, 2017 at 11:34 AM, Glenn Knickerbocker <n...@bestweb.net>
wrote:
> I wanted a list of all methods of an object. After a little puzzling and
> review, I found it in object~instancemethods~allindexes. Along the way,
> though, I was looking at collections of methods with ~allitems instead,
> and was reminded that the method objects don't actually have names of
> their own at all. A single method, then, could be added to a class or
> object with any number of method names. Similarly, a single routine
> could be added to a package with any number of routine names.
>
> That got me wondering: What if I wanted a method or routine to act
> differently depending on its name? So I dug some more and found
> .context~name, which tells me the name of the currently running method or
> routine.
>
> But now suppose I'm tracing and don't know where I am. That gives me the
> name, but can I tell whether I'm in a method, a named routine, or an
> internal routine?
>
> PARSE SOURCE tells me if I'm in a method, but not whether I'm in an
> internal routine in that method. SIGL will be set at the start of an
> internal routine, but might be explicitly set or dropped elsewhere.
>
> Outside of a method, if the package name from PARSE SOURCE (also in
> .context~package~name) doesn't match .context~name, I must be in a named
> or internal routine but don't know which kind. If they do match, I might
> be in the main program--but it's also possible I'm in a routine that was
> added later.
>
> /* deliberately confusing:
> add a routine with the same name and package name
> as the package we're in now
> */
> .context~package~addroutine(.context~package~name,,
> ,routine~new(.context~package~name,,
> 'Trace ?R;Parse Source;Say .context~name'))
>
> Call (.context~package~name)
>
> Is there any more direct indication of what kind of routine I'm in?
>
> ¬R
>
>
> ------------------------------------------------------------
> ------------------
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, SlashDot.org! http://sdm.link/slashdot
> _______________________________________________
> Oorexx-users mailing list
> Oorexx-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/oorexx-users
>
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
Oorexx-users mailing list
Oorexx-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/oorexx-users