[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
re: What does DOTIMES mean?
Date: 20 Nov 89 1018 PST
From: Dick Gabriel <RPG@SAIL.Stanford.EDU>
The reason I ask is that Qlisp implicitly creates some closures, and a typical
(dotimes (i <form>) (spawn ... <form involving i>))
There is a closure made for the inne form. Intuitively, i should be
treated as a constant for each execution of the body (in Qlisp), and this
can be accomplished by a fresh binding for i each time around. I was
wondering whether this implementation is legal in Common Lisp.
I'm actually not sure how to answer that, or whether there is an answer.
Qlisp is clearly not Common Lisp, in that Common Lisp doesn't have parallel
processing. But then the question is really whether Qlisp's implementation
of DOTIMES should make a binding every time, not about any of Qlisp's
extensions. It seems that it is valid to make a binding every time, but
perhaps not desirable since that might cause portability problems to other
Lisps that don't work that way. An alternate approach that we use sometimes
is to make SPAWN copy variables that are referenced free in its body (with
an option to tell it which variables to share rather than copying).
If Common Lisp was reasonable, it wouldn't leave this question unspecified.
Instead, compilers would be smart enough to figure out when the optimal
iteration code can be generated and when it cannot be, based on analyzing the
body of the iteration construct. But I don't think Common Lisp is going to
be that reasonable. Since we never thought before that this was important
enough to spend time on, we probably don't think it's important enough to
change at the last minute.