Re: Iteration in lisp
- From: Kent M Pitman <pitman@xxxxxxxxxxx>
- Date: 30 Apr 2008 04:58:09 -0400
Duane Rettig <duane@xxxxxxxxx> writes:
However, there is absolutely a very good reason for doing this warning
in other situations - namely, in compiled code.
In my personal opinion (i.e., not an attempt to interpret the spec):
I agree that style warnings for all manner of things in compiled code
is fine, because they are suppressable ... with the caveat that
in implementations that implement eval by
(defun eval (x)
(funcall (compile nil `(lambda () ,exp))))
I think they should suppress style warnings that might be given by
the file compiler or even perhaps explicit uses of COMPILE. Because
compile is sub-primitive here, the implementation shouldn't take its
incidental use of compilation as an excuse to overwhelm the user with
random output.
And interactively, with an immediate funcall, the user will find out
soon enough about the style problem.
My remarks were about the ability to do things like automatic
programming by cobbling together bits of code and EVAL'ing it.
That reason is, in a
single word: "spelling". In reality, lisp programs which are
candidates for compilation are less likely to have (setq x 1) for a
form, and more likely to have a form that looks something like
(setq *long-variable-with-spelling-that-doesnt-match-its-defunition*
1) for which it may be hard to see the mistake (how long did it take
for you to find it?). In this case it is likely that no actual
variable looks like this one, and thus it is likely that this name is
a mistake.
And even so, with EVAL, I'd rather not know and find out at runtime.
- - -
The reason for my remark was particularly aimed at two camps:
(1) The extreme camp that says "oops, you misspelled something. I've
helpfully autodeclared it pervasively special." I think this is
really definitely not good.
(2) The moderate but still unwanted-by-me situation of taking
TOPLEVEL-LISP-PROMPT> (setq x 3)
or a programmatic call to (eval '(setq x 3))
as an opportunity to lecture the person about how x is undeclared and
maybe you don't really mean for it to be special. As I said, I can tolerate
it being silently taken as lexical in an implementation that wants to offer
such support, even by default. But what I don't want to be told is "I'm not
going to do something cool and innovative, nor am I even going to do the
obvious only thing that's left to do in the absence of something cool and
innovative--I'm just going to tell you that Lisp is hard to use and that you
should have an unpleasant interactive experience."
I actually don't know which implementations do this. I just know people
complain that some do and seem not to like writing SETQ at toplevel.
I have found Lisp very hard to teach with DEFVAR having to be used
interactively in a teaching session, because that forces me to have to use
*'s or have non-*'d variables end up pervasively SPECIAL. So it's the cascade
of those two things that troubles me. I want to use non-*'d variables in
early teaching, and so I want to use SETQ on them, not DEFVAR.
.
- Follow-Ups:
- Re: Iteration in lisp
- From: Duane Rettig
- Re: Iteration in lisp
- From: John Thingstad
- Re: Iteration in lisp
- References:
- Iteration in lisp
- From: rigaha@xxxxxxxxx
- Re: Iteration in lisp
- From: Kent M Pitman
- Re: Iteration in lisp
- From: John Thingstad
- Re: Iteration in lisp
- From: Kent M Pitman
- Re: Iteration in lisp
- From: Robert Maas, http://tinyurl.com/uh3t
- Re: Iteration in lisp
- From: Kent M Pitman
- Re: Iteration in lisp
- From: Scott Burson
- Re: Iteration in lisp
- From: Duane Rettig
- Iteration in lisp
- Prev by Date: Re: postmodern thread safety in prepared statements functionality
- Next by Date: Re: Questions - Higer Order Functions
- Previous by thread: Re: Iteration in lisp
- Next by thread: Re: Iteration in lisp
- Index(es):
Relevant Pages
|