[Top][All Lists]

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

Re: crazy interaction between buffer-locality and function-locality of v

From: Stefan Monnier
Subject: Re: crazy interaction between buffer-locality and function-locality of variables
Date: Sun, 02 Nov 2008 15:05:21 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (gnu/linux)

> My point was that the only way to avoid mixing the behaviors is to
> make variable names unwieldy.  As an async-event-handler-writer all
> function arguments and local variables must be
> globally-uniquely-named, and as a major-mode writer all buffer-local
> variables must be globally-uniquely-named.

Actually, function arguments (and typical local variables) don't need to
be globally unique: they just need to use a name space that's not used
for buffer-local variables.

In Emacs we get this behavior as follows: buffer-local variables should
use a package prefix.

> The latter is perhaps not too terrible a burden, but the former would
> make coding in elisp unbearable IMO.

Indeed, which is why the convention moves the responsability to the
buffer-local side.

>> > there needs to be strong guidance against making variables whose names
>> > /aren't/ prefixed with the package name buffer-local.
>> Agreed.  Where would you like to see it?  In the coding conventions?

> At least also at the same place as the warning about the conflict
> between buffer-locals and let-binding in elisp.info that I pointed to
> in my original email.  But also this should be a great big warning in
> the defun docs of the make-variable-*-local and make-local-variable
> since it's the authors using those functions (and friends?  I don't
> have a complete list) that must shoulder the burden of avoiding
> collisions.

Hmm... at the place you mentioned in the elisp.info, we're kind of far
from discussing naming conventions, but I'll try and add a cross-ref.


reply via email to

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