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

  1. Path: sparky!uunet!mcsun!uknet!comlab.ox.ac.uk!imc
  2. From: imc@comlab.ox.ac.uk (Ian Collier)
  3. Newsgroups: comp.lang.rexx
  4. Subject: Re: Curious Question
  5. Message-ID: <2420.imc@uk.ac.ox.prg>
  6. Date: 11 Sep 92 10:48:50 GMT
  7. References: <Leon_Davidoff.04fe@panam.wimsey.bc.ca>
  8. Organization: Oxford University Computing Laboratory, UK
  9. Lines: 34
  10. X-Local-Date: Friday, 11th September 1992 at 11:48am BST
  11. Originator: imc@msc2.comlab
  12.  
  13. In article <Leon_Davidoff.04fe@panam.wimsey.bc.ca>, Leon_Davidoff@panam.wimsey.bc.ca (Leon Davidoff) wrote:
  14.  
  15. >What I would like to know is why b in Test1 is assigned the value ' y'
  16. >while in Test2 the value is 'y'.
  17.  
  18. The reason is because the writer of ARexx (at least until v1.15 - if I
  19. remember correctly) didn't read a full description of the parse instruction
  20. closely enough before implementing it (IMHO).
  21.  
  22. You may know that in:
  23.  
  24. parse value "  alpha  beta  gamma  delta  " with a b c d
  25.  
  26. a, b and c contain no blanks whatsoever, whereas d may (and in fact does in
  27. this case).  Because d is the last name in a list of symbols, it retains all
  28. the blanks which were not eaten by the preceeding template.  ARexx takes
  29. this to mean that d contains two leading blanks and two trailing blanks.
  30. However, the truth is that the blank which immediately follows "gamma" was
  31. used up in order to separate "gamma" from " delta  " - and so d should only
  32. contain one leading blank.
  33.  
  34. A consequence of this is that in:
  35.  
  36. parse value "1 2 3" with a b c
  37.  
  38. ARexx retains the space which precedes the "3", whereas standard Rexx does
  39. not.  There are two fixes to this: (a) [when c might contain multiple words]
  40. say "c=strip(c)" just after parsing, and (b) [when c must contain at most
  41. one word] follow the template with a dot, as in:
  42.  
  43. parse value "1 2 3" with a b c .
  44.  
  45. Ian Collier
  46. Ian.Collier@prg.ox.ac.uk | imc@ecs.ox.ac.uk
  47.