On 12.08.2022 17:46, Erich Steinböck wrote:
call ppJavaExceptionChain(co,.true)
This look suspicious to me and may be unintended.
Here ppJavaExceptionChain is called with a single argument, an Array of (co,
.true)
I think it's a bit unfortunate that we allow this kind of syntax (as it's
almost always unintended).
Indeed this is (unintended and) surprising as it is clearly looks like a function call (no space
between name and opening parenthesis).
Also some error messages become misleading, e.g. the following program
-- line # 1
call reverse('rid')
say "RESULT:" result
say
call substr('abcdef',2,3)
say "RESULT:" result
yields surprisingly
G:\test\oorexx\native\exception>test3
RESULT: dir
6 *-* call substr('abcdef',2,3)
Error 40 running G:\test\oorexx\native\exception\test3.rex line 6:
Incorrect call to routine.
Error 40.3: Not enough arguments in invocation of SUBSTR; minimum expected
is 2.
---
Replacing line # 1 with "trace i" yields
G:\test\oorexx\native\exception>test3
>>> "N"
3 *-* call reverse('rid')
>L> "rid"
>A> "rid"
>>> "dir"
4 *-* say "RESULT:" result
>L> "RESULT:"
>V> RESULT => "dir"
>O> " " => "RESULT: dir"
>>> "RESULT: dir"
RESULT: dir
5 *-* say
>>> ""
6 *-* call substr('abcdef',2,3)
>L> "abcdef"
>A> "abcdef"
>L> "2"
>A> "2"
>L> "3"
>A> "3"
>>> "an Array"
>A> "an Array"
6 *-* call substr('abcdef',2,3)
Error 40 running G:\test\oorexx\native\exception\test3.rex line 6:
Incorrect call to routine
Error 40.3: Not enough arguments in invocation of SUBSTR; minimum expected
is 2.
So the call of the label (built-in function SUBSTR) is carried out but (compared to the pre array
notation) wrongly with a single array as argument instead of the three individual arguments listed
within the parentheses.
A possible solution for the CALL (special case) instruction would be to not create the array from
the arguments when the opening parenthesis follows immediately the Rexx symbol (i.e. formed like a
function call): any arguments within the parentheses are then supplied as individual arguments of
the call to the label ; such a possible (making it backwardly compatible) solution would need to be
documented in the CALL keyword documentation, now that the array notation is there).
[In the general case, in all other contexts substr('abcdef',2,3) would be taken as a function call
such that the parentheses with comma separated arguments is not seen as an array notation.]
---rony
_______________________________________________
Oorexx-devel mailing list
Oorexx-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/oorexx-devel