home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!usc!sdd.hp.com!swrinde!gatech!darwin.sura.net!paladin.american.edu!auvm!DKNKURZ1.BITNET!RZOTTO
- From: RZOTTO@DKNKURZ1.BITNET (Otto Stolz)
- Newsgroups: comp.lang.rexx
- Subject: Re: ARG() behaviour
- Message-ID: <REXXLIST%92091517555696@DEARN>
- Date: 15 Sep 92 23:23:38 GMT
- Sender: REXX Programming discussion list <REXXLIST@UGA.BITNET>
- Lines: 82
- Comments: Gated by NETNEWS@AUVM.AMERICAN.EDU
- X-Acknowledge-To: <RZOTTO@DKNKURZ1>
- In-Reply-To: Message of Mon,
- 14 Sep 92 16:23:04 EDT from <ophof@SERVER.UWINDSOR.CA>
-
- Hi everybody,
-
- on Mon, 14 Sep 92 16:23:04 EDT Scott Ophof said:
- > The ARG() function behaves differently in different implementations
- > and levels.
- > The following returns either 4, 5, or 6, depending on the opsys.
- > Note that there are 5 commas in the call to FUNCTION()...
- > /* Behaviour of ARG() */
- > Trace OFF
- > Say Function('The number', 'of',, 'argstrings',,)
- > Exit
- > Function: Procedure
- > Return arg
- > According to "The REXX Language" (2nd edition), "4" should be the
- > correct answer. Has this changed since TRL-1?
-
- As I understand TRL-1, it leaves the problem unsolved.
-
- Rather than TRL-2, I have the IBM manual
- SC24-5549-0 SAA/CPI Procedure Language Level 2 Reference".
- This clarifies the issue: in Level 2, the (corrected) above example
- should say "4". I'll append the detailed reasoning for those interested.
-
- With the tiny correction
- : Function: Procedure
- : Return arg()
- applied, the above example says "6" when running under CMS REXX 3.40),
- and "5" when running under Personal REXX 2.00D2.
-
- Apparently, sloppy language in the original language definition has
- already lead to mutually incompatible implementations. This is another
- example of the issues the REXX standard committee will have to clarify
- to arrive at an unmistakable standard (pre-requisite for the desired
- portability of REXX programs).
-
- Best wishes,
- Otto Stolz <RZOTTO@DKNKURZ1.Bitnet>
- <RZOTTO@nyx.uni-konstanz.de>
- - - - - - - -
-
- TRL-1 uses the term "number of argument strings passed" without any
- definition; it defines the term "an argument string exists" by the notion
- "it was explicitely specified when the routine was invoked". The de-
- scription of the ARG() function contains two examples to clarify the
- issue; the latter of these shows that after
- Function('The number', 'of',, 'argstrings')
- the expression arg() inside FUNCTION would yield 4, and arg(i,"E")
- would yield "1", for 3 values of i. According to the definition of the
- ARG function in TRL-1, this would imply that
- Function('The number', 'of',, 'argstrings')
- would "pass" 4 arguments to FUNCTION, 3 of which would be "explicitely
- specified".
-
- Regrettably, there is no example in TRL-1 covering the case of
- Function('The number', 'of',, 'argstrings',,)
- leaving the issue of omitted (i.e. "not explicitely specified")
- *trailing* arguments undefined. Until yesterday, I was under the im-
- pression that the latter example would "pass" 6 arguments, 3 of them
- being "explicitely specified", but after my test with Personal REXX and
- after scrutinizing the "Level 2 Reference", I am not sure, anymore.
-
- The "Level 2 Reference" has added a further note to ARG()'s definition:
- : The number of argument strings is the largest number n for which
- : ARG(n,'e') would return 1. That is, it is the position of the last
- : explicitely defined argument string.
-
- As the examples cover the notion of "explicitly specified arguments"
- quite thoroughly, I think that the above note resolves the issue of
- omitted trailing arguments: both
- Function('The number', 'of',, 'argstrings')
- and
- Function('The number', 'of',, 'argstrings',,)
- would "pass" 4 arguments to FUNCTION(), 3 of which would be "explicitely
- specified" (according to Level 2 rules).
-
- So, IBM has defined SAA REXX Level 2 to be incompatible (in this
- respect) with at least one existing SAA REXX Level 1 implementation,
- viz. CMS REXX 3.40.
-
- Though I don't have TRL-2 at hand, I suppose that it has the same
- (or an equivalent) note added to ARG()'s description. Will anybody
- confirm, or deny, this conjecture?
-