home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #3 / NN_1993_3.iso / spool / comp / lang / pop / 230 < prev    next >
Encoding:
Internet Message Format  |  1993-01-28  |  2.6 KB

  1. From: kers@hplb.hpl.hp.com (Chris Dollin)
  2. Date: Wed, 27 Jan 1993 14:23:26 GMT
  3. Subject: Re: Re: dlocals etc. (and shallow binding)
  4. Message-ID: <KERS.93Jan27142326@cdollin.hpl.hp.com>
  5. Organization: Hewlett-Packard Laboratories, Bristol, UK.
  6. Path: sparky!uunet!munnari.oz.au!spool.mu.edu!sdd.hp.com!hpscit.sc.hp.com!hplextra!otter.hpl.hp.com!hpltoad!cdollin!kers
  7. Newsgroups: comp.lang.pop
  8. References: <C1CAwq.8up@cs.bham.ac.uk> <116670051@otter.hpl.hp.com> <1993Jan26.160320.27465@cm.cf.ac.uk> <C1ID7x.FDE@cs.bham.ac.uk>
  9. Sender: news@hplb.hpl.hp.com (Usenet News Administrator)
  10. Lines: 41
  11. In-Reply-To: axs@cs.bham.ac.uk's message of 27 Jan 93 10:31:09 GMT
  12. Nntp-Posting-Host: cdollin.hpl.hp.com
  13.  
  14.  
  15. The discussion about definable constants (or not) reminds me of the
  16. similar situation in Pepper. I intend Pepper to be used interactively,
  17. in the same way as Pop, and yet wish to avoid some of the strange effects
  18. (such as redefinable constants).
  19.  
  20. The Pepper solution is this. First, there are two kinds of declarations,
  21. ``val'' and ``var''. Identifiers declared by ``val'' are not assignable
  22. (the declaration initialises them), while those declared by ``val'' are.
  23.  
  24. [Quickly scanning the Pepper code to hand, I see more than 750 ``val''s 
  25. and less than 250 ``var''s. These figures are distored in favour of
  26. ``var'' (yes, in *favour* of *vaR*) because (a) var's tend to appear
  27. at top level, (b) there are two very similar large programs in my
  28. sample, which both (c) use var's to cope with the bootstrap compilers
  29. inability to have top-level val declarations with run-time initialisation
  30. values.]
  31.  
  32. Names are redefinable (``fluid'') or not (``static''; these terms are
  33. not fixed, not least because the compiler doesn't do this yet!). 
  34. Redefinable constants (val's) are just like variables, except for being
  35. unassignable; that is, when they are redefined, everyone sees the new
  36. value (unlike Pop constants). Unredefinable constants get their values
  37. compiled into the code.
  38.  
  39. Qualifiers on declarations allow the programmer to choose between
  40. re- and unre- definable. The default in interactive use is re-; for
  41. batch compilation, it is unre-. (Just as well, because the bootstrap
  42. compiler doesn't allow any sort of redefinition.)
  43.  
  44. Thus you can never over-ride a static val's value, and a fluid val's 
  45. value is subject to change without notice. There will be a way to 
  46. pick the default qualifier, so you can make an interactive compilation
  47. get you static val's. The effect of Pop's ``protected'' will probably
  48. be obtained by the as-yet-vague module system.
  49.  
  50.  
  51. --
  52.  
  53. Regards | "Always code as if the guy who ends up maintaining your code will be
  54. Kers.   | a violent psychopath who knows where you live." - John F. Woods
  55.