[Openmcl-devel] process-run-function and "dynamic vs lexical"

Bill St. Clair billstclair at gmail.com
Thu Oct 22 19:40:58 UTC 2009


On Thu, Oct 22, 2009 at 3:27 PM, Taoufik Dachraoui
<taoufik.dachraoui at wanadoo.fr> wrote:
> Ok let me be more methodic...

> Dynamic variables sould not be pervasive (unwelcome) but should be
> used with some
> confidence by all programmer and not only experts should use them; For
> this they need
> to be easy to understand and intuitive (no surprises only when there
> is an obvious error
> in the program).

Whether or not it's a good idea, special variable proclamations are
pervasive in Common Lisp. So once you evaluate (DEFVAR X) in your
environment, the compiler will treat all subsequent bindings of X as
dynamic. That's how Common Lisp is defined. That's how every
implementation I've used works. Hence the strong suggestion to name
your global variables so that it's obvious that they're special (*X*
or +X+, not X). There's no way to tell by looking at a code fragment
which variables will be dynamically bound. That depends on which
variables are declared special in the compilation environment. You may
not like it, but if you're programming in Common Lisp, that's just how
it is.

-Bill



More information about the Openmcl-devel mailing list