home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!cs.utexas.edu!uwm.edu!ogicse!mintaka.lcs.mit.edu!concerto.lcs.mit.edu!boaz
- From: boaz@concerto.lcs.mit.edu (Boaz Ben-Zvi)
- Newsgroups: gnu.emacs.help
- Subject: Re: Prefix in Emacs Lisp "packages"
- Message-ID: <1992Aug25.211644.4639@mintaka.lcs.mit.edu>
- Date: 25 Aug 92 21:16:44 GMT
- Article-I.D.: mintaka.1992Aug25.211644.4639
- References: <1532@lysator.liu.se> <9208190614.AA01268@mole.gnu.ai.mit.edu>
- Sender: news@mintaka.lcs.mit.edu
- Reply-To: boaz@lcs.mit.edu
- Organization: Laboratory for Computer Science, MIT
- Lines: 38
-
- In article <9208190614.AA01268@mole.gnu.ai.mit.edu>, rms@gnu.ai.mit.edu (Richard Stallman) writes:
-
- |> There is no formal concept of packages in Emacs Lisp.
- |> We use naming conventions to indicate which functions
- |> and variables belong together. Often the convention is
- |> a common prefix, but it is not required to be a prefix
- |> all the time.
-
- Here is what we lose in elisp by using prefix conventions rather than
- some encapsulation/packaging mechanism:
-
- 1. Inside the "package": Every variable (or internal function) name must be
- written in full. For example:
-
- (setq my-package-variable1 (my-package-function1 my-package-variable2))
-
- rather than
-
- (setq variable1 (function1 variable2))
-
- 2. Outside the "package": Users can (intentionally or unintentionally)
- access the internals of the package, typically resulting in
- mysterious bugs. For example, a hash-table package with an internal
- counter of empty slots. If that counter is named "counter" (prefix not
- required; see above), some other application may mistakenly modify it.
- If it is named "hash-table-counter", still some hacker may find that
- things can be sped up by zeroing this variable .... (guess the rest).
-
- -- Boaz
-
- ===============================================================================
- _ _ __ __ ___ _ _ __ ___ ____ ___
- /_) _ _ __ /_) _ __ __ _/ o | | \| __ | | / \ | |
- /__)(_)(_|__/ /__)(_'_/ / /__\/_( __|_ __\ | __|_ \ __\| __|_
- __) |
- ===============================================================================
- Boaz Ben-Zvi <boaz@lcs.mit.edu> MIT Addr: NE43-526 Tel: (617) 253-6212
- ===============================================================================
-