home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.pascal
- Path: sparky!uunet!elroy.jpl.nasa.gov!aero.org!jordan
- From: jordan@aero.org (Larry M. Jordan)
- Subject: Re: Is this legal - why/why not?
- Message-ID: <1992Jul30.182727.9048@aero.org>
- Sender: news@aero.org
- Organization: The Aerospace Corporation
- References: <l7b682INNasf@muleshoe.cs.utexas.edu> <1992Jul29.072408.23090@monu6.cc.monash.edu.au> <1992Jul29.201359.4297@nntpd.lkg.dec.com>
- Date: Thu, 30 Jul 1992 18:27:27 GMT
- Lines: 29
-
- In article <1992Jul29.201359.4297@nntpd.lkg.dec.com> reagan@hiyall.enet.dec.com (John R. Reagan) writes:
- [stuff deleted]
- >
- >There must be bugs in the compilers you use. There is nothing
- >wrong with redefining predeclared identifiers. They aren't special
- >in this regard. You just can't use the same identifier for two
- >things in the same scope. For example,
- >
- >type foo = integer;
- > integer = 1..10;
- >
- >is illegal since integer was used for 2 things in the same scope.
- >
-
- Looks legal to me. Works fine on Sun Pascal. The first integer is
- from an 'enclosing' scope. The second integer 'masks' the integer from
- the enclosing scope. The two integer's are used in the same block,
- but each has a different scope! According to Ghezzi and Jazayeri,
- "Programming Language Concepts":
-
- The scope of a variable is the range of program instructions over
- which the variable is known.
-
- (This definition applies to types and constants as well).
-
- The above example does not violate the scope rule.
-
- --Larry %)
-
-