eval form supposed to evaluate a given form in a null lexical environment, I don't get what I expect

后端 未结 2 443
谎友^
谎友^ 2021-01-11 13:23

Let\'s say I have a special var:

(defvar x 20)

then I do the following:

(let ((x 1)) (eval \'(+ x 1))

whi

2条回答
  •  無奈伤痛
    2021-01-11 13:51

    DEFVAR declares its variables special. Globally, everywhere. You can also not remove this easily.

    That's also the reason you should never use common names like x, i, list as variable names for DEFVAR. Make sure that you use *x*, *i* and *list* instead. Otherwise all variables, even local ones, with these common names are declared special.

提交回复
热议问题