[Openmcl-devel] process-run-function and "dynamic vs lexical"
tfb at tfeb.org
Fri Oct 23 05:01:01 EDT 2009
On 22 Oct 2009, at 20:27, Taoufik Dachraoui wrote:
> After defining x using defvar, the let block do not follow the specs;
> in the specs,
> let creates a new variable binding and that binding is lexical unless
> the name
> is declared special.
Yes, it does follow the spec, because DEFVAR arranges that *all*
bindings of the variable are special. That's what DEFVAR does, and
that's what the spec says it does.
"defparameter and defvar establish name as a dynamic variable." and
"dynamic variable n. a variable the binding for which is in the
dynamic environment. See special."
Yes, this is confusing because you can't tell easily whether a binding
is lexical or dynamic: that is arguably a deficiency in CL, although
it could probably not have been avoided given the behaviours of the
Lisps with which CL needed to be compatible.
The *x* convention is how one works around this issue.
The behaviour with regards to threads is obviously not defined in the
spec, but CCL does the common thing: special bindings are per-thread.
More information about the Openmcl-devel