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