Scott L. Burson
Wed, 14 May 1997 21:46:04 -0700 (PDT)
[Warning: rant follows]
From: email@example.com (Henry G. Baker)
Date: Tue, 13 May 1997 14:03:35 -0700 (PDT)
There is a very good question about how to dynamically affect the
'defaults' of some complex operation. Dynamic variables are one way,
but the other ways all have there problems, as well. E.g., having to
pass 23 parameters to each function a la large Fortran systems, most
of which are always the same.
The proper way to deal with setting up defaults is to create an instance
packaging up the defaults and then invoking the methods of that instance.
I never miss dynamic binding when I'm programming in a real object-oriented
language, or even C++.
I agree with this sentiment. However, there are things for which
'dynamic' binding is best -- i.e., (with-new-transaction ...).
But this is an example where it seems to me that the correct semantics are
those of LET-GLOBALLY rather than of LET, i.e., any bindings established are
visible to all threads. (At least, I don't know how to have some threads in a
process be involved in a transaction while other threads aren't.)
LET-GLOBALLY, for those who don't know, is a Zetalisp function implemented in
a straightforward way using UNWIND-PROTECT:
(let-globally ((var val)) . body)
(let ((#:G23982 var))
(setq var val)
(progn . body)
(setq var #:G23982)))