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

  1. Path: sparky!uunet!zaphod.mps.ohio-state.edu!pacific.mps.ohio-state.edu!linac!unixhub!unixhub.SLAC.Stanford.EDU
  2. From: bobcook@unixhub.SLAC.Stanford.EDU (Bob Cook)
  3. Newsgroups: comp.lang.rexx
  4. Subject: Re: NOVALUE (was: Blanks, REXX, and portability...)
  5. Message-ID: <5467@unixhub.SLAC.Stanford.EDU>
  6. Date: 12 Sep 92 01:18:34 GMT
  7. References: <MARTINC.92Sep10225633@grover.cs.unc.edu>
  8. Sender: news@unixhub.SLAC.Stanford.EDU
  9. Reply-To: bobcook@unixhub.SLAC.Stanford.EDU (Bob Cook)
  10. Lines: 47
  11. Nntp-Posting-Host: scsnext1.slac.stanford.edu
  12.  
  13. Charles R. Martin writes
  14. >In article <5456@unixhub.SLAC.Stanford.EDU> bobcook@unixhub.SLAC.Stanford.EDU  
  15. (Bob Cook) writes:
  16. >
  17. >   (Somewhat) unfortunately, SIGNAL ON NOVALUE doesn't catch all of the
  18. >   uses of an undefined variable.  At least, it doesn't on VM/CMS.  In
  19. >   the following piece of code, the "say" statement produces "Hi" on the
  20. >   console, even though it uses the variable named X, which has never
  21. >   been initialized.
  22. >
  23. >     signal on novalue
  24. >     dummy = 'X' 
  25. >     a.dummy = 'Hi'
  26. >     say a.x
  27. >     exit
  28. >   Novalue: Say 'Oops'
  29. >
  30. >I'm pretty new at this, but I *think* that's the defined behavior, not a
  31. >bug.
  32.  
  33. I think I gave the wrong impression.  I did not mean to say I thought it was  
  34. incorrect; merely that I thought it was somewhat unfortunate.  I misled by  
  35. including "At least, it doesn't on VM/CMS.", which was there just to say I only  
  36. really know about that implementation.
  37.  
  38. I discussed this point (a LONG time ago) with Mike Cowlishaw.  He made it clear  
  39. that the behavior was intentional, but (if I recall correctly) he chose it as  
  40. the better of two choices, each of which had its pros and cons.  I think I  
  41. agree with his choice.  But I ALSO miss having the reference to x in a.x  
  42. treated as a NOVALUE condition.
  43.  
  44. Dave Gomberg writes
  45. >There is no occurance of a variable named x in this program fragment.  There
  46. >is a constant whose value is the single letter X in upper case, and there is
  47. >a variable reference to a.x.  This is no more a reference to x then a.2 is
  48. >a reference to the number 2.  To see this, notice that the number 2 (or any
  49. >number) is to be taken in some base, while the notion of base is completely
  50. >irrelevant in the reference to a.2.  There, 2 is just a one character string.
  51.  
  52. That is exactly the point that I'm commenting upon.  I have been bitten by  
  53. introducing a hard-to-find bug because a reference to "a.x", where x was meant  
  54. to be a variable, instead treated the x as a constant because the variable x  
  55. had (mistakenly) never had a value assigned.
  56.  
  57. --
  58. Bob Cook                              bobcook@slac.stanford.edu
  59. Stanford Linear Accelerator Center    NeXT mail okay
  60.