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