emacs-devel
[Top][All Lists]
Advanced

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

Re: optimizing defconst


From: Dan Nicolaescu
Subject: Re: optimizing defconst
Date: Sat, 27 Oct 2007 19:28:47 -0700

Stefan Monnier <address@hidden> writes:

  > > (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'.  

One can make the argument that we can also use the analogy with
defmacro. If a macro is redefined at run time, the compiled code does
not know about it. It's not far fetched to do the same about defconst.

I am not necessarily saying that we should make that change, but at
least it would be nice to have this documented in the docstring for
defconst.




reply via email to

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