If a Rexx program starts with a hashbang (shebang) like "#!/usr/bin/rexx", the built-in function SOURCELINE()
(and .context~package~source
and .context~package~sourceLine
) will report a different value for the first line
This code ..
1 2 3 4 5 | #!/usr/bin/rexx -- what does sourceline(1) return? do line = 1 to 3 say line":" sourceline(line) end |
.. when run with 4.2 will report
1: --/usr/bin/rexx 2: -- what does sourceline(1) return? 3: do line = 1 to 3
.. when run with 5.0 will report
1: 2: -- what does sourceline(1) return? 3: do line = 1 to 3
Should we care? If so, what do we want it to return?
In any case, I assume, we should document this behaviour.
(I also notice that the docs don't mention the fact that Rexx programs may start with a hashbang line)
Anonymous
I would argue that hashbang is part of the source and should be properly reported
in its entirety. My justification: The program won't run on linux w/o it.
I understand the argument
'To satisfy archaic OSes, ooRexx allows a source file to
start with "#!". The interpreter treats the line as a comment.'
However, I don't think it
should lie to the programmer about the contents of the line!
Nothing more archaic than using file types/file extensions to denote the command processor.
And Rexx programs run just fine without it, i.e. "rexx myprogram arg1 arg2".
Bruce
Sent by Magic!
Related
Bugs:
#1394I would argue that if the non-linux/unix versions show '/Rexx /' as the first line, then it would also show the hashbang line. Both lines serve the same function of alerting the OS to the interpreter to be used to interpret the file.
Code committed [r11615]
Related
Commit: [r11615]
Added tests with [r11620]
Related
Commit: [r11620]