unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Drew Adams <drew.adams@oracle.com>
To: uzibalqa <uzibalqa@proton.me>, CToID <funk443@yahoo.com.tw>
Cc: "help-gnu-emacs@gnu.org" <help-gnu-emacs@gnu.org>
Subject: RE: [External] : Re: Names to defun, defvar, defconst
Date: Mon, 1 Jul 2024 22:32:53 +0000	[thread overview]
Message-ID: <SJ0PR10MB54884A79B9E1981756307D60F3D32@SJ0PR10MB5488.namprd10.prod.outlook.com> (raw)
In-Reply-To: <j3FVfKCq_O9OsNRd6oTgB9PJNXKQlmx6SSwD10YMMvUuT27ugVVpc7QKZjvsOu3MMwZpLf-t03BZz0K8RzvO84KJ6dlJRnxtIJEGjchypkk=@proton.me>

> > So these are all valid names
> > (defun func1
> > (defvar var2
> > (defconst const3
>
> Of course they are, I believe these kind of names
> are valid in almost every single programming language.

You can use pretty much any chars.  Some chars
(e.g. SPC) you need to escape, with \.  E.g.

 (defun \;not\ a\ comment ()
   (message "A function.")
   42)

This prints "A function." and returns 42:

 (\;not\ a\ comment)

You can't use a keyword name (e.g. `:foo')
with defconst.

You _can_ use a keyword name with defvar, but
it doesn't do anything.  Symbols with keyword
names as their `symbol-name' always evaluate
to themselves.

To me, using defvar with a keyword name should
be a BUG, just as it is with defconst.

(defvar :foo 42 "101010") raises no error, and
evaluating `:foo' as a variable returns `:foo',
not 42, because it's a keyword, i.e., a constant.

  reply	other threads:[~2024-07-01 22:32 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-07-01 20:14 Names to defun, defvar, defconst uzibalqa
2024-07-01 20:37 ` CToID
     [not found] ` <1914797742.11180.1719865741072@mail.yahoo.com>
     [not found]   ` <N-WomROhsQbqycJ7xelPXzdxPQS1v1PljZZaDu0i0G8PGR73Qjrb49DeBX1K7POfXnnwqQT_7bLksXzvgbf4eN1HyWPv82hEW-E9Y7CJbqU=@proton.me>
2024-07-01 20:42     ` CToID
2024-07-01 21:48       ` uzibalqa
2024-07-01 22:32         ` Drew Adams [this message]
2024-07-01 22:41           ` [External] : " Drew Adams
2024-07-02  3:34           ` Stefan Monnier via Users list for the GNU Emacs text editor
2024-07-02  3:42             ` Drew Adams
2024-07-01 23:21 ` tpeplt

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=SJ0PR10MB54884A79B9E1981756307D60F3D32@SJ0PR10MB5488.namprd10.prod.outlook.com \
    --to=drew.adams@oracle.com \
    --cc=funk443@yahoo.com.tw \
    --cc=help-gnu-emacs@gnu.org \
    --cc=uzibalqa@proton.me \
    /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.
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).