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

  1. Newsgroups: comp.lang.pascal
  2. Path: sparky!uunet!elroy.jpl.nasa.gov!usc!sol.ctr.columbia.edu!destroyer!ubc-cs!alberta!kakwa.ucs.ualberta.ca!muskwa.ucs.ualberta.ca!dhalliwe
  3. From: userDHAL@mts.ucs.UAlberta.CA (David Halliwell)
  4. Subject: Re: Is this legal - why/why not?
  5. Message-ID: <dhalliwe.712524093@muskwa.ucs.ualberta.ca>
  6. Sender: news@kakwa.ucs.ualberta.ca
  7. Nntp-Posting-Host: muskwa.ucs.ualberta.ca
  8. Organization: University Of Alberta, Edmonton Canada
  9. References: <l7b682INNasf@muleshoe.cs.utexas.edu> <1992Jul29.072408.23090@monu6.cc.monash.edu.au> <1992Jul29.201359.4297@nntpd.lkg.dec.com> <Bs6L75.BDK@knot.ccs.queensu.ca> <1992Jul30.174037.6433@nntpd.lkg.dec.com>
  10. Date: Thu, 30 Jul 1992 19:21:33 GMT
  11. Lines: 43
  12.  
  13. reagan@hiyall.enet.dec.com (John R. Reagan) writes:
  14.  
  15.  
  16. >In article <Bs6L75.BDK@knot.ccs.queensu.ca>, dmurdoch@QueensU.CA (Duncan Murdoch) writes...
  17. >> 
  18. >>Is that really illegal, or did you make a typo?  It compiles just as
  19. >>you'd expect in Turbo Pascal:  "foo" becomes the standard 16 bit integer
  20. >>type, "integer" becomes the subrange 1..10.  TP processes the declarations
  21. >>strictly sequentially; I had thought standard Pascal did it that way
  22. >>too.
  23.  
  24. >Nope, I didn't make a typo.  The Pascal standard doesn't discuss
  25. >"sequential" anything.  The "INTEGER = 1..10" is a defining occurrance
  26. >of the identifier INTEGER for the entire region (the region goes backwards
  27. >to the beginning of the block).  This definition of INTEGER retroactively
  28. >changes the previous use of INTEGER in the definition of FOO.  You now
  29. >have a "use before declare" situation and thats illegal.
  30.  
  31.     Are you sure that standard Pascal doesn't discuss sequential
  32. anything? I always thought that the basic governing principle of
  33. Pascal was that *everything* in the language definition was sequential:
  34. you can't do anything unless you have already told the compiler about
  35. it. Of course, the compiler has predefined types, etc., but beyond
  36. those basics you have to declare or define everything. You can't refer
  37. to a variable, function, or procedure until the code that defines it
  38. has been compiled. If you *have* to (due to interdependencies), then
  39. you need to forward declare the procedure.
  40.   
  41.     To retroactively change the previous use would require multiple
  42. passes through the source code. And then we would be reduced to
  43. FORTRAN compile speeds ;-)
  44.  
  45.     Or am I suffering a memory parity error?
  46.  
  47. >Of course, noone claims that Turbo Pascal is standards conforming...
  48.  
  49.    Amen to that.
  50.   
  51.  
  52. Dave Halliwell
  53. Department of Geography
  54. University of Alberta
  55. Edmonton, Alberta
  56.