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

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

Re: Working with constansts


From: Barry Margolin
Subject: Re: Working with constansts
Date: Wed, 13 May 2009 00:59:58 -0400
User-agent: MT-NewsWatcher/3.5.3b3 (Intel Mac OS X)

In article <mailman.7052.1242121473.31690.help-gnu-emacs@gnu.org>,
 Nikolaj Schumacher <me@nschum.de> wrote:

> Richard Riley <rileyrgdev@googlemail.com> wrote:
> 
> >> Because this would incur overhead on every assignment, as it would have 
> >> to check whether the variable being assigned was declared as a constant.  
> >> Since this is so rarely the case, this overhead could be seen as mostly 
> >> wasted and unnecessary.
> >
> > I don't know enough about Lisp than I can only assume that in this case
> > it can not be detected at compile time IF you compile to byte/p code.
> 
> "Thanks" to dynamic scoping it cannot be caught at compile time.

It could at least generate a warning.

> (defconst xxx nil)
> 
> (defun change-xxx ()
>   (setx xxx t)) ;; const or variable?
> 
> (let ((xxx nil))
>   (change-xxx))

This should also warn about binding a constant.

-- 
Barry Margolin, barmar@alum.mit.edu
Arlington, MA
*** PLEASE post questions in newsgroups, not directly to me ***
*** PLEASE don't copy me on replies, I'll read them in the group ***


reply via email to

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