help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: never use `eval' (was: Re: How to mapcar or across a list?)


From: Emanuel Berg
Subject: Re: never use `eval' (was: Re: How to mapcar or across a list?)
Date: Fri, 17 Jul 2015 02:55:27 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4 (gnu/linux)

Remember when I said the byte compiler should be more
offensive and offer more elaborate style warnings?

And this is a good example of that!

Even in the Emacs help

    (describe-function 'eval)

it doesn't say anything about the dangers of the
"nil environment":

    Evaluate FORM and return its value.
    If LEXICAL is t, evaluate using lexical scoping.
    LEXICAL can also be an actual lexical environment,
    in the form of an alist mapping symbols to
    their value.

This book -

    @book{artificial-intelligence-and-the-design,
      title      = {Artificial Intelligence and the Design of Expert Systems},
      author     = {George Luger and William Stubblefield},
      publisher  = {Benjamin-Cummings},
      year       = 1989,
      ISBN       = 0805301399
    }

- has a chapter on LISP. One of the first things
they mention is `eval', and they mention it in
connection to the `quote', eval "undoing" quote so you
get the feeling it is as indispensible. There are
several examples using it.

Their other LISP isn't that good either by the way.
There are several examples where they do (car l)
several times in one execution branch instead of
`let'ing it be a local identifier; and, they speak
appreciatively of all the different types of recursion
(tail etc.) but at least so far hasn't mentioned (and
will they?) anything of the drawbacks of recursion in
terms of efficiency. (When I started out with Lisp,
coming "closest" from SML of the languages I did
then, I did recursion all the time by the way.)

-- 
underground experts united
http://user.it.uu.se/~embe8573




reply via email to

[Prev in Thread] Current Thread [Next in Thread]