[Top][All Lists]

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

Re: Possible defvar bug

From: Tassilo Horn
Subject: Re: Possible defvar bug
Date: Mon, 18 Feb 2013 16:42:57 +0100
User-agent: Gnus/5.130006 (Ma Gnus v0.6) Emacs/24.3.50 (gnu/linux)

Alan Mackenzie <address@hidden> writes:

>> ELISP> (let ((foo 3))
>>       (defvar foo 1)
>>       (print foo))
>> 3
>> ELISP> foo
>> *** Eval error ***  Symbol's value as variable is void: foo
>> ELISP> 
>> And, no, this is almost never what you want :-) Just like Tassilo
>> noticed by accident.
> Why would anybody want to defvar a variable inside a let binding which
> also defines it, anyway?

Yes, these minimal examples look weired.  The real code was a bit more

  (let* ((crm-separator ",") ...)

and `function-that-might-read-multiple-values-using-crm' dispatches if
one or multiple separated values are to be read, and then delegates to a
read-single-value or read-multiple-values-with-crm function.  The latter
required crm when being called.

The let-binding of `crm-separator' was just meant as a default value in
case crm was going to be used, because all LaTeX keyval-options use ","
to separate key-value pairs.


reply via email to

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