home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #16 / NN_1992_16.iso / spool / comp / lang / pascal / 4625 < prev    next >
Encoding:
Text File  |  1992-07-30  |  1.4 KB  |  41 lines

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