From: Thorsten Jolitz <tjolitz@gmail.com>
To: help-gnu-emacs@gnu.org
Subject: Re: defvar vs defconst
Date: Sat, 03 Aug 2013 09:43:05 +0200 [thread overview]
Message-ID: <87txj71api.fsf@gmail.com> (raw)
In-Reply-To: 87siyr78ck.fsf@ericabrahamsen.net
Eric Abrahamsen <eric@ericabrahamsen.net> writes:
> Thorsten Jolitz <tjolitz@gmail.com> writes:
>
>> Hi List,
>>
>> when you define a variable that should not be touched/set by the user of
>> your library (which is most likely a programmer), but will be frequently
>> set to a new value by your own program - would you call that a VAR or a
>> CONST?
>>
>> (defconst ...) signals "don't touch this", which seems to the right
>> thing in this case, but OTOH it is a bit strange to call something a
>> constant that not only can be changed, but will actually be changed
>> quite often.
>
> In addition to the other answers, which make perfect sense, you can also
> look in existing libraries and see what other people do. I've found that
> pretty much all "internal" variables -- last-abbrev-location,
> org-capture-current-plist, basically any variables used to preserve
> state -- are defined with defvar.
Pretty clear picture - I will use 'defvar then. Thanks to everybody.
--
cheers,
Thorsten
next prev parent reply other threads:[~2013-08-03 7:43 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-08-02 9:49 defvar vs defconst Thorsten Jolitz
2013-08-02 21:49 ` Stefan Monnier
2013-08-03 3:37 ` Eric Abrahamsen
2013-08-03 7:43 ` Thorsten Jolitz [this message]
[not found] <mailman.2402.1375476850.12400.help-gnu-emacs@gnu.org>
2013-08-02 21:05 ` Emanuel Berg
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87txj71api.fsf@gmail.com \
--to=tjolitz@gmail.com \
--cc=help-gnu-emacs@gnu.org \
/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 external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.