>>>> "Glynn" == Glynn Clements
<glynn(a)sensei.co.uk> writes:
Glynn> Sure, but how much code requires function arguments to be dynamically
Glynn> scoped? I'm sure that there's plenty of code which uses e.g.
Glynn> (let ((case-fold-search t)) ...
Glynn> but I would have thought that
Glynn> (defun foo (case-fold-search) ...
Glynn> was substantially less common.
True. It is mostly used when one function in a package calls another
`internal' function, and is too lazy to pass in the argument, so it
uses dynamic scoping to let it happen for free.
Glynn> Aside from any performance implications, dynamic scope also introduces
Glynn> the possibility of accidentally binding a global variable which is
Glynn> referenced by a called function. It's not as if elisp uses the *foo*
Glynn> convention for special variables.
True. It would be nice to make the change to have lexical scoping for
function arguments and let bound variables by default, just for the
sake of code cleanliness.
The byte compiler can find most of the occurrences of violations of
this coding practice. It will be relatively easy to add the
appropriate defvars to all the code that we maintain. Much harder
will be the issue of breaking everyone else's lisp code.
Martin