Re: Iteration in lisp

Matthias Benkard <mulkiatsch@xxxxxxxxx> writes:

On 3 Mai, 07:14, lisp1.3.CalRob...@xxxxxxxxxxxxxxx (Robert Maas, wrote:
From: Kent M Pitman <pit...@xxxxxxxxxxx>
I was talking more about the notion that
 (progv '(x) '(3)
   (eval '(+ x 1)))
is not portably well-defined without doing
 (progv '(x) '(3)
   (eval '(locally (declare (special x)) (+ x 1))))

Oh, maybe I saw that many months ago and ignored it because I never
use PROGV in my code anyway. I just treat PROGV as a useless crock,
like COERCE.

PROGV is not the issue here. Free variable references are the issue.
Isn't the behaviour of

(let ((x 3))
(declare (special x))
(eval '(+ x 1)))

just as ill-defined?

Thanks for making this point. Yes. PROGV is a red herring here.

The main reason that PROGV was used in my example is that if you were
building a simple scripting language or a rule-based language and
wanted to establish a few bindings and then allow a situation where
script-supplied expressions were evaluated in the context of those names,
you couldn't just do a simple eval on what the user provides you, and
that's a shame because while it's not done a whole lot, it's very appealing
to people trying to understand why Lisp is different than other languages
because other languages don't easily let you do that... and the way it's
defined right now, Lisp is also putting roadblocks in your way, so it
makes the point blurrier.

I rarely PROGV directly, and its syntax is kind of lousy, but it is
one of those subprimitive thigns that is sometimes useful for
implementing other facilities.