home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #19 / NN_1992_19.iso / spool / gnu / emacs / help / 3840 < prev    next >
Encoding:
Text File  |  1992-08-25  |  2.3 KB  |  52 lines

  1. Path: sparky!uunet!cs.utexas.edu!uwm.edu!ogicse!mintaka.lcs.mit.edu!concerto.lcs.mit.edu!boaz
  2. From: boaz@concerto.lcs.mit.edu (Boaz Ben-Zvi)
  3. Newsgroups: gnu.emacs.help
  4. Subject: Re: Prefix in Emacs Lisp "packages"
  5. Message-ID: <1992Aug25.211644.4639@mintaka.lcs.mit.edu>
  6. Date: 25 Aug 92 21:16:44 GMT
  7. Article-I.D.: mintaka.1992Aug25.211644.4639
  8. References: <1532@lysator.liu.se> <9208190614.AA01268@mole.gnu.ai.mit.edu>
  9. Sender: news@mintaka.lcs.mit.edu
  10. Reply-To: boaz@lcs.mit.edu
  11. Organization: Laboratory for Computer Science, MIT
  12. Lines: 38
  13.  
  14. In article <9208190614.AA01268@mole.gnu.ai.mit.edu>, rms@gnu.ai.mit.edu (Richard Stallman) writes:
  15.  
  16. |> There is no formal concept of packages in Emacs Lisp.
  17. |> We use naming conventions to indicate which functions 
  18. |> and variables belong together.  Often the convention is
  19. |> a common prefix, but it is not required to be a prefix
  20. |> all the time.
  21.  
  22. Here is what we lose in elisp by using prefix conventions rather than
  23. some encapsulation/packaging mechanism:
  24.  
  25. 1. Inside the "package": Every variable (or internal function) name must be 
  26.    written in full. For example:
  27.  
  28.     (setq my-package-variable1 (my-package-function1 my-package-variable2))
  29.  
  30.    rather than
  31.  
  32.     (setq variable1 (function1 variable2))
  33.  
  34. 2. Outside the "package": Users can (intentionally or unintentionally)
  35.    access the internals of the package, typically resulting in 
  36.    mysterious bugs.  For example, a hash-table package with an internal 
  37.    counter of empty slots. If that counter is named "counter" (prefix not
  38.    required; see above), some other application may mistakenly modify it.
  39.    If it is named "hash-table-counter", still some hacker may find that
  40.    things can be sped up by zeroing this variable .... (guess the rest).
  41.  
  42. -- Boaz
  43.  
  44. ===============================================================================
  45.   _              _            __         __ ___  _ _   __ ___    ____      ___
  46.  /_) _  _  __   /_) _   __ __ _/    o     |   |   \| __ |   |     /    \ |   |
  47. /__)(_)(_|__/  /__)(_'_/ /   /__\/_(        __|_ __\    | __|_     \  __\| __|_
  48.           __)                                           |                      
  49. ===============================================================================
  50.  Boaz Ben-Zvi <boaz@lcs.mit.edu>     MIT Addr: NE43-526   Tel: (617) 253-6212 
  51. ===============================================================================
  52.