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

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

Re: lexical binding changes symbol standard-value property


From: Stefan Monnier
Subject: Re: lexical binding changes symbol standard-value property
Date: Thu, 30 Jun 2016 03:43:23 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1.50 (gnu/linux)

> (car (get 'dummy-var 'standard-value))
> ;; => t

(car (get 'dummy-var 'standard-value)) is defined to contain an
*expression* rather than a *value*.

> I can resolve with:
> (eval (car (get 'dummy-var 'standard-value)
> ;; => t
> ...but not sure about using (eval ...)

Using `eval' is (and always has been) the only correct way to get the
"standard-value".

E.g.

    (defcustom sm-test (+ 1 2) "hello")
    (car (get 'sm-test 'standard-value))

returns (+ 1 2) rather than 3 (well, with lexical-binding it returns
yet something else, but that is also an expression which evaluates to
3).


        Stefan




reply via email to

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