emacs-devel
[Top][All Lists]
Advanced

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

Re: Why is Elisp's defvar weird? And is eval_sub broken?


From: Daniel Colascione
Subject: Re: Why is Elisp's defvar weird? And is eval_sub broken?
Date: Sun, 15 Feb 2015 06:17:45 -0800
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.4.0

On 02/14/2015 06:36 AM, Stefan Monnier wrote:
>> A declaration of free dynamic variables for a function could tell the
>> byte compiler that those free variables aren't typos, since
>> otherwise the byte compiler would expect either the symbol to be
>> declared special or a lexical variable by that name to be in scope.
> 
> There is such a declaration already.  It's called (defvar <foo>).  Tada!
> 
>>> Normally, such conflicts should never happen
>>> because all special vars should be named with a "package prefix", but
>>> sadly, reality is different, so it was indispensable to make this
>>> effect local, to allow lexical-binding code to work reliably.
>> By using llet, the byte compiler will catch such conflicts, and your code
>> (interpreted or compiled) that uses it will work reliably despite the
>> conflicts. This means defvar's weird behavior is no longer needed.
> 
> It's not weird once you understand that it's a compiler directive which
> is absent from the .elc file.

How are users supposed to understand that when it's completely absent
from the documentation?

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

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