emacs-devel
[Top][All Lists]
Advanced

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

Re: Typo in defconst-1 and defvar-1 docstrings?


From: Philip Kaludercic
Subject: Re: Typo in defconst-1 and defvar-1 docstrings?
Date: Thu, 06 Oct 2022 19:48:40 +0000

Stefan Monnier <monnier@iro.umontreal.ca> writes:

>> I was reading through the implementation of defconst-1, but was confused
>> by the docstring that states:
>>
>>    More specifically behaves like (defvar SYM 'INITVALUE DOCSTRING).
>                                      ^^^^^^
>
> It says "defconst" for me (as it should).  Am I missing something?

I copied the wrong example, my bad.

>> Isn't the point of defconst-1 as a functional variant of defconst,
>
> It is.
>
>> that SYM will evaluate to a symbol?
>
> In the function the SYM received is already a symbol.
>
>> And why should INITVALUE be quoted?
>
> Because similarly in the function INITVALUE is really a *value*
> (i.e. already evaluated), so in order for `defconst` to behave the same,
> you need to quote it to prevent treating that value as an expression
> that needs to be evaluated.
>
> E.g. if INITVALUE is the list `(1 2 3)` and SYM is the symbol `hello`,
> the equivalent is
>
>     (defconst hello '(1 2 3))
>
> and not
>
>     (defconst 'hello (1 2 3))
>
> which would signal an error because of the quoted symbol and because of
> the call to the "function" 1.

OK, I misunderstoond what the comment was trying to say.  Sorry for the
noise.

>         Stefan



reply via email to

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