[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: optimizing defconst
From: |
Stefan Monnier |
Subject: |
Re: optimizing defconst |
Date: |
Sat, 27 Oct 2007 16:32:04 -0400 |
User-agent: |
Gnus/5.11 (Gnus v5.11) Emacs/23.0.50 (gnu/linux) |
> (defconst viper-xemacs-p (featurep 'xemacs))
> (defun foo()
> (if viper-xemacs-p (error "Hmmmm")))
> Shouldn't `foo' be optimized to just do nothing?
Can't do it: some code might do (setq viper-xemacs-p t) before calling
`foo'. Such code might be flagged by the byte-compiler with a warning "setq
on a constant", but it's only a warning and it's not always caught.
We could change `defconst' so that it really defines constants (on which
`setq' fails) and then such an optimization might be acceptable, but this is
a non-trivial change.
Stefan
- optimizing defconst, Dan Nicolaescu, 2007/10/27
- Re: optimizing defconst,
Stefan Monnier <=
- Re: optimizing defconst, Dan Nicolaescu, 2007/10/27
- Re: optimizing defconst, Richard Stallman, 2007/10/28
- Re: optimizing defconst, Kim F. Storm, 2007/10/29
- Re: optimizing defconst, Juanma Barranquero, 2007/10/29
- Re: optimizing defconst, Johan Bockgård, 2007/10/29
- Re: optimizing defconst, Davis Herring, 2007/10/29
- Re: optimizing defconst, Richard Stallman, 2007/10/29
Re: optimizing defconst, John Paul Wallington, 2007/10/27
Re: optimizing defconst, Kim F. Storm, 2007/10/27