Make your own free website on Tripod.com
6.4. The Trouble Begins

There is one very big problem with extensions. If you want to be
able to turn them on and off during execution, then your program
has to be a bit careful.

More and more REXX interpreters (including Regina seem to do a
parsing when the interpreter is started. The “old” way was to
postpone the parsing of each clause until it was actually
executed.  This leads to the problem mentioned.

Suppose you want to use an extension that allows a slightly
different syntax, for the sake of the argument, let us assume that
you allow an expression after the SELECT keyword. Also assume that
this extension is only allowed in extended more, not in “standard
mode”.  However, since Regina parses the source code only once
(typically at the starts of the program), the problem is a catch-
22: the extension can only be turned on after parsing the program,
but it is needed before parsing. This also applies to a lot of
other REXX interpreters, and all REXX compilers and preprocessors.

If the extension is not turned on during parsing, it will generate
a syntax error, but the parsing is all done before the first
clause is executed. Consequently, this extension can not be turned
on during execution, it has to be set before the parsing starts.

Therefore, there are two alternative ways to invoke a set of
extensions.

·    It can be invoked by using the -e option to the interpreter.
  The word following the option is the extension or standard to
  invoke. Multiple -e options can be specified.

·    It can be invoked by setting the environment variable
  REXXEXTS, which must be a string of the same format as the
  parameters to the OPTIONS clause.




PREV NEXT