[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: defvar vs defconst
From: |
Thorsten Jolitz |
Subject: |
Re: defvar vs defconst |
Date: |
Sat, 03 Aug 2013 09:43:05 +0200 |
User-agent: |
Gnus/5.130002 (Ma Gnus v0.2) Emacs/24.3 (gnu/linux) |
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