[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Toplevel lexical variables



If you expand the example to:

(let ((x 1))
  (defun f ()
    x)
  (defun g (bar)
    ...
    (setq x ...)
    ...))

It becomes clear that this sort of structure is quite useful.  X may
be a private constant or a private "global" shared by the two top
level functions F and G.  The same sort of information hiding can be
done with packages, but both the cost and code complexity will rise.

This style is more common in Scheme than Common Lisp but it seems to
me that Common Lisp implementations are required to support it.

                                            dan

In real life: Dan Pierson, Encore Computer Corporation, Research
Usenet: {talcott,linus,necis,decvax,ihnp4}!encore!pierson
Arpanet: pierson@multimax.arpa