home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #20 / NN_1992_20.iso / spool / comp / lang / rexx / 936 < prev    next >
Encoding:
Text File  |  1992-09-08  |  2.3 KB  |  58 lines

  1. Newsgroups: comp.lang.rexx
  2. Path: sparky!uunet!mcsun!sunic!sejnet.sunet.se!eric
  3. From: eric@sejnet.sunet.se (Eric Thomas)
  4. Subject: Re: Blanks, REXX, and portability...
  5. Message-ID: <1992Sep8.162542.1@sejnet.sunet.se>
  6. Lines: 45
  7. Sender: news@sunic.sunet.se
  8. Reply-To: ERIC@SEARN.SUNET.SE
  9. Organization: SUNET, Stockholm, Sweden
  10. References: <REXXLIST%92090701303986@UGA.CC.UGA.EDU> <MARTINC.92Sep7104222@grover.cs.unc.edu> <1966@coyote.UUCP>
  11. Date: Tue, 8 Sep 1992 16:25:42 GMT
  12.  
  13. In article <1966@coyote.UUCP>, drake@drake.almaden.ibm.com (Sam Drake) writes:
  14. >>line='foo     bar     bletch' /* that's <space><tab> */
  15. >>parse var line a b c
  16. >>
  17. >>it makes sense to have a='foo', b='bar', and c='bletch', and to have
  18. >>parse eat both whitespace characters just as it already eats any string
  19. >>of blanks between non-blank maximals.  
  20. > I'm just a simple guy, but I can't think of anything wrong with this.
  21. > What's the argument on this point, if any?
  22.  
  23. Taking the REXX language as it is today (tab et al not treated as whitespace
  24. characters), you cannot implement JUST this one change without breaking
  25. everything. You have to change a bunch of other functions to keep a homogeneous
  26. behaviour. For instance, it is common to code:
  27.  
  28. Do Words(list)
  29.    Parse var list elm list
  30.    <...>
  31. End
  32.  
  33. WORDS and PARSE had better agree on how many times to run the loop. Similarly,
  34. WORD must produce the same result in case you read the elements with
  35. WORD(list,i). After doing 'list = Space(list,0)', it is reasonable for the
  36. programmer to assume that Words(list) = 1 (or possibly 0, but surely not 2).
  37. Thus SPACE must be changed as well, and the same goes for STRIP, and so on.
  38. Now, once you have changed STRIP, it is necessary to have (I'll use ASCII)
  39. '09'x = ' ', '0D'x = ' ', etc. That might be a surprise to existing programs.
  40. That's a lot of places to change, too. And still there are things which are not
  41. too easy to do, for instance translating all white space to a blank or some
  42. other character, or expanding tabs. It can be done, but the language won't help
  43. you do this.
  44.  
  45. The alternative is to add an EXPAND function and enhance PARSE so that
  46.  
  47.                   PARSE EXPAND something pattern
  48.  
  49. is equivalent to
  50.  
  51.                   PARSE VALUE EXPAND(something) WITH pattern
  52.  
  53. much like PARSE UPPER is equivalent to PARSE VALUE TRANSLATE() WITH. One new
  54. function, which is useful on its own, and one place to change.
  55.  
  56.   Eric
  57.