On Mon, 29 Nov 2021, at 23:42, Glenn Knickerbocker wrote:
> On 11/14/2021 2:58 AM, Sahananda Sahananda wrote:
>> ooRexx checks syntax before running the code, so classic rexx
>> interpreters can tolerate syntax errors in lines of code that are never
>> interpreted, whereas ooRexx will inform you of those errors and not run.
>
> Whoa, that's something I missed in my post about this way back and
> somehow never filled in before.  Classic Rexx never has to scan to the
> end of the file unless you call a routine that it doesn't find
> internally.  Object Rexx has to scan the entire file for any ::OPTIONS
> and ::REQUIRES directives to process before it can start executing the
> main routine.

It's not just about scanning to the end of the file.  I have some KEXX 
macros (ie things that execute in the Kedit text editor, written in its 
own subset of Classic REXX), which I also execute under the ooREXX
interpreter, from the command prompt.

Near the start of the code I check literals in "parse source" and "parse
version" and set a flag saying which interpreter is running the code.  (I 
know I could in theory just check one or other value but prefer to look
at both in case of future surprises).

Obviously, to keep ooREXX happy, these macros have to be perfectly
valid ooREXX programs.  But they contain occasional lines like

  if interpreter == "ooREXX" then do
       /* offer a choice */
       oodlog = .ListChoice~new(ootext,ootitl,oomn.,oosizx,oosizy,ooinit)
  end
  else do
      /* code to offer a choice using a kedit popup menu */
  end

and the KEXX interpreter never examines the line inside the do/end
because the condition is never true when it is executing.

The code inside the Kedit side of the statement is syntactically valid 
ooREXX (though wouldn't actually make sense to ooREXX as it's full
of Kedit commands - but ooREXX just sees literal strings, like any 
other commands being passed to a host environment - and calls of
Kedit functions.  The latter would certainly cause problems if ooREXX
tried to execute that code, but it passes a syntax check ok.

There /would/ be a problem if ooREXX were ever to get to the stage
of attempting to ensure that external functions were findable before
the code executes. 

-- 
Jeremy Nicoll - my opinions are my own.


_______________________________________________
Oorexx-users mailing list
Oorexx-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/oorexx-users

Reply via email to