[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Dynamic variables
Will>Neither the deep-binding nor the shallow-binding implementation
Will>in terms of DYNAMIC-WIND seems capable of supporting a tail-call
Will>semantics for CALL-WITH-DYNAMIC-BINDING.
Unless, as usual, one is willing to test at such tail-calls
whether they redefine a dynamic variable, and if they do,
one does -not- save the corresponding binding since it would
be restored uselessly.
Price: more tests at runtime.
Evaluation: (1) calling and dynamically binding infinitely many
variables is not properly tail-recursive since only tail-recursive
calls that re-bind a variable can be performed properly;
(2) calling with N (N is finite) different dynamic variables
is properly tail-recursive "modulo" N.
So a "tail-call semantics" for CALL-WITH-DYNAMIC-BINDING is possible.
Most French Lisp systems actually used this technique.