unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Philip Kaludercic <philipk@posteo.net>
To: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: emacs-devel@gnu.org
Subject: Re: Typo in defconst-1 and defvar-1 docstrings?
Date: Thu, 06 Oct 2022 19:48:40 +0000	[thread overview]
Message-ID: <875ygwlomf.fsf@posteo.net> (raw)
In-Reply-To: <jwva668u5gn.fsf-monnier+emacs@gnu.org> (Stefan Monnier's message of "Thu, 06 Oct 2022 15:22:26 -0400")

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	other threads:[~2022-10-06 19:48 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-06 18:45 Typo in defconst-1 and defvar-1 docstrings? Philip Kaludercic
2022-10-06 18:48 ` Philip Kaludercic
2022-10-06 20:06   ` Stefan Monnier
2022-10-06 19:22 ` Stefan Monnier
2022-10-06 19:48   ` Philip Kaludercic [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=875ygwlomf.fsf@posteo.net \
    --to=philipk@posteo.net \
    --cc=emacs-devel@gnu.org \
    --cc=monnier@iro.umontreal.ca \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).