From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Dan Nicolaescu Newsgroups: gmane.emacs.devel Subject: Re: optimizing defconst Date: Sat, 27 Oct 2007 19:28:47 -0700 Message-ID: <200710280228.l9S2Sldn002915@oogie-boogie.ics.uci.edu> References: <200710271747.l9RHlQ53020242@oogie-boogie.ics.uci.edu> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1193538653 14498 80.91.229.12 (28 Oct 2007 02:30:53 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 28 Oct 2007 02:30:53 +0000 (UTC) Cc: emacs-devel@gnu.org To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sun Oct 28 03:30:53 2007 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1IlxvR-0007Jx-BF for ged-emacs-devel@m.gmane.org; Sun, 28 Oct 2007 03:30:53 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1IlxvH-000230-Vz for ged-emacs-devel@m.gmane.org; Sat, 27 Oct 2007 22:30:44 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1IlxvD-0001zh-IV for emacs-devel@gnu.org; Sat, 27 Oct 2007 22:30:39 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1IlxvD-0001yK-0U for emacs-devel@gnu.org; Sat, 27 Oct 2007 22:30:39 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1IlxvC-0001yC-Pa for emacs-devel@gnu.org; Sat, 27 Oct 2007 22:30:38 -0400 Original-Received: from oogie-boogie.ics.uci.edu ([128.195.1.41]) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1IlxvC-0002Bx-In for emacs-devel@gnu.org; Sat, 27 Oct 2007 22:30:38 -0400 Original-Received: from mothra.ics.uci.edu (mothra.ics.uci.edu [128.195.6.93]) by oogie-boogie.ics.uci.edu (8.13.6/8.13.6) with ESMTP id l9S2Sldn002915; Sat, 27 Oct 2007 19:28:47 -0700 (PDT) In-Reply-To: (Stefan Monnier's message of "Sat\, 27 Oct 2007 16\:32\:04 -0400") Original-Lines: 19 X-ICS-MailScanner: Found to be clean X-ICS-MailScanner-SpamCheck: not spam, SpamAssassin (score=-1.44, required 5, autolearn=disabled, ALL_TRUSTED -1.44) X-ICS-MailScanner-From: dann@mothra.ics.uci.edu X-detected-kernel: by monty-python.gnu.org: Solaris 9 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:81913 Archived-At: Stefan Monnier 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.