home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #20 / NN_1992_20.iso / spool / comp / lang / rexx / 1031 < prev    next >
Encoding:
Internet Message Format  |  1992-09-15  |  4.0 KB

  1. Path: sparky!uunet!usc!sdd.hp.com!swrinde!gatech!darwin.sura.net!paladin.american.edu!auvm!DKNKURZ1.BITNET!RZOTTO
  2. From: RZOTTO@DKNKURZ1.BITNET (Otto Stolz)
  3. Newsgroups: comp.lang.rexx
  4. Subject: Re: ARG() behaviour
  5. Message-ID: <REXXLIST%92091517555696@DEARN>
  6. Date: 15 Sep 92 23:23:38 GMT
  7. Sender: REXX Programming discussion list <REXXLIST@UGA.BITNET>
  8. Lines: 82
  9. Comments: Gated by NETNEWS@AUVM.AMERICAN.EDU
  10. X-Acknowledge-To: <RZOTTO@DKNKURZ1>
  11. In-Reply-To:  Message of Mon,
  12.               14 Sep 92 16:23:04 EDT from <ophof@SERVER.UWINDSOR.CA>
  13.  
  14. Hi everybody,
  15.  
  16. on Mon, 14 Sep 92 16:23:04 EDT Scott Ophof said:
  17. > The ARG() function behaves differently in different implementations
  18. > and levels.
  19. > The following returns either 4, 5, or 6, depending on the opsys.
  20. > Note that there are 5 commas in the call to FUNCTION()...
  21. >    /* Behaviour of ARG() */
  22. >    Trace OFF
  23. >      Say Function('The number', 'of',, 'argstrings',,)
  24. >      Exit
  25. >    Function:  Procedure
  26. >      Return arg
  27. > According to "The REXX Language" (2nd edition), "4" should be the
  28. > correct answer.  Has this changed since TRL-1?
  29.  
  30. As I understand TRL-1, it leaves the problem unsolved.
  31.  
  32. Rather than TRL-2, I have the IBM manual
  33.   SC24-5549-0 SAA/CPI Procedure Language Level 2 Reference".
  34. This clarifies the issue: in Level 2, the (corrected) above example
  35. should say "4".  I'll append the detailed reasoning for those interested.
  36.  
  37. With the tiny correction
  38. :    Function:  Procedure
  39. :      Return arg()
  40. applied, the above example says "6" when running under CMS REXX 3.40),
  41. and "5" when running under Personal REXX 2.00D2.
  42.  
  43. Apparently, sloppy language in the original language definition has
  44. already lead to mutually incompatible implementations. This is another
  45. example of the issues the REXX standard committee will have to clarify
  46. to arrive at an unmistakable standard (pre-requisite for the desired
  47. portability of REXX programs).
  48.  
  49. Best wishes,
  50.                     Otto Stolz <RZOTTO@DKNKURZ1.Bitnet>
  51.                                <RZOTTO@nyx.uni-konstanz.de>
  52. - - - - - - -
  53.  
  54. TRL-1 uses the term "number of argument strings passed" without any
  55. definition; it defines the term "an argument string exists" by the notion
  56. "it was explicitely specified when the routine was invoked". The de-
  57. scription of the ARG() function contains two examples to clarify the
  58. issue; the latter of these shows that after
  59.      Function('The number', 'of',, 'argstrings')
  60. the expression arg() inside FUNCTION would yield 4, and arg(i,"E")
  61. would yield "1", for 3 values of i. According to the definition of the
  62. ARG function in TRL-1, this would imply that
  63.      Function('The number', 'of',, 'argstrings')
  64. would "pass" 4 arguments to FUNCTION, 3 of which would be "explicitely
  65. specified".
  66.  
  67. Regrettably, there is no example in TRL-1 covering the case of
  68.      Function('The number', 'of',, 'argstrings',,)
  69. leaving the issue of omitted (i.e. "not explicitely specified")
  70. *trailing* arguments undefined. Until yesterday, I was under the im-
  71. pression that the latter example would "pass" 6 arguments, 3 of them
  72. being "explicitely specified", but after my test with Personal REXX and
  73. after scrutinizing the "Level 2 Reference", I am not sure, anymore.
  74.  
  75. The "Level 2 Reference" has added a further note to ARG()'s definition:
  76. : The number of argument strings is the largest number n for which
  77. : ARG(n,'e') would return 1. That is, it is the position of the last
  78. : explicitely defined argument string.
  79.  
  80. As the examples cover the notion of "explicitly specified arguments"
  81. quite thoroughly, I think that the above note resolves the issue of
  82. omitted trailing arguments: both
  83.      Function('The number', 'of',, 'argstrings')
  84. and
  85.      Function('The number', 'of',, 'argstrings',,)
  86. would "pass" 4 arguments to FUNCTION(), 3 of which would be "explicitely
  87. specified" (according to Level 2 rules).
  88.  
  89. So, IBM has defined SAA REXX Level 2 to be incompatible (in this
  90. respect) with at least one existing SAA REXX Level 1 implementation,
  91. viz. CMS REXX 3.40.
  92.  
  93. Though I don't have TRL-2 at hand, I suppose that it has the same
  94. (or an equivalent) note added to ARG()'s description. Will anybody
  95. confirm, or deny, this conjecture?
  96.