help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: Confusion about elisp symbols and defuns


From: Nicolas Richard
Subject: Re: Confusion about elisp symbols and defuns
Date: Wed, 24 Sep 2014 11:18:43 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.93 (gnu/linux)

dieter@duenenhof-wilhelm.de (H. Dieter Wilhelm) writes:

> Hello (),
>
> Calc checks in calc-var-value if variables are bound.  This works for
> examplwe with the variable symbol `g'
>
> (calc-var-value 'g)
> nil
>
> but bombs for the variable `v'
>
> (calc-var-value 'v)> => error

The error is (void-function v) and that comes from the fact calc-var-value does:
(set v (funcall (symbol-value v)))
It does so after checking (symbolp (symbol-value v)) but does not check
that this symbol indeed has a function definition.

I don't know why calc-var-value does what it does, so I don't know what
the fix is. Perhaps checking for (fboundp (symbol-value v)) would
help a bit (or functionp instead of fboundp).

OTOH, obviously calc-var-value believes that it has the right to change
the value cell of its argument, so I guess calling (calc-var-value 'v)
doesn't actually make sense, and there's no point in fixing
calc-var-value for this specific wrong use of it.

-- 
Nicolas Richard



reply via email to

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