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

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

Re: Declaring a local dynamic variable?


From: Barry Margolin
Subject: Re: Declaring a local dynamic variable?
Date: Mon, 23 Sep 2013 20:03:39 -0400
User-agent: MT-NewsWatcher/3.5.3b3 (Intel Mac OS X)

In article 
<address@hidden>,
 Joost Kremers <address@hidden> wrote:

> Barry Margolin wrote:
> > In article 
> > <address@hidden>,
> >  Joost Kremers <address@hidden> wrote:
> >> Well, it would be great if the byte compiler could distinguish between
> >> the two cases, but apparently it's not. So I guess the question comes
> >> down to how easy/difficult would it be to implement a compiler that can?
> >
> > On what basis would it distinguish them? Search all packages to see if 
> > any of them declare the variable?
> 
> I realise that's a rhetorical question, but that wouldn't be a very good

Maybe the second one is slightly rhetorical, but the first certainly 
wasn't. The difficulty isn't in implementation, it's in defining what 
you mean by "a compiler that can". You can't implement something without 
a specification of what it's supposed to do, and "do the right thing" is 
not really detailed enough.

> idea. Suppose you mistype a local variable and some package happens to
> define a dynamic variable with the misspelled name...

That would be pretty unlikely, considering that package developers are 
strongly encouraged to follow naming conventions. All the global 
variables in a package should be prefixed with something identifying the 
package (some programmers copy CL-style package:XXX naming, some use 
package-XXX).

On the other hand, most programmers tend to use relatively short names 
for local variables. The chance that a typo will happen to match one of 
those prefixed variables is

-- 
Barry Margolin, address@hidden
Arlington, MA
*** PLEASE post questions in newsgroups, not directly to me ***


reply via email to

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