We had a discussion a while back about the adding an implementation of
a class that will retrieve the current execution context via the
environment variable .CONTEXT.  This now implemented in trunk, and
here's the initial set of things I allow you to access via .CONTEXT:

- package  This is the package object that contains the currently
executing "thing" (method or routine).  The package object has a lot
of capability within it for resolving packages, classes, routines,
etc, as well as things like access to the source code for the package.

- executable The .Routine or .Method object that's currently
executing.  I'm welcome discussion about the "spelling" of this
method, as I'm not completely sure I like EXECUTABLE.  We need
something that can capture that this can be either a method or a
routine.

- digits The current context digits setting

- form The current numeric form

- fuzz The current numeric fuzz

- args Retrieves the arguments used to invoke this context, as an array

- condition Retrieves the current condition object for this context.
Returns .nil if nothing has been trapped.

- variables Returns a supplier that allows iteration through all of
the current variables.  This only returns top-level variables (i.e.,
simple variables and stems).  Compound variables, of course, can be
accessed by using stem object values associated with a stem variable.

Some notes.

1)  Currently, these are "read-only" values.  I'm not sure I'm
prepared to start down the slipperly slope of allowing this object to
be used to changes settings/variables.  I'm not totally opposed to it,
but I'm erring on the side of caution for now.  This class makes it
fairly easy to add those capabilities in the future if we decide this
would be a good thing.

2)  The object returned by .CONTEXT is only valid as long as the
context it was retrieved from is active.  Invoking any of the
RexxContext methods will raise an error if that context has been
terminated.

3)  Similarly, RexxContext objects cannot be copied.  The copy()
method will also raise an error.

4)  Adding new stuff to this is fairly easy.  If you see a need for
something, speak up (particularly something that's basically
read-only....see note 1).

Rick

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Oorexx-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/oorexx-devel

Reply via email to