From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Re: optimizing defconst Date: Sat, 27 Oct 2007 16:32:04 -0400 Message-ID: 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 1193517144 28776 80.91.229.12 (27 Oct 2007 20:32:24 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 27 Oct 2007 20:32:24 +0000 (UTC) Cc: emacs-devel@gnu.org To: Dan Nicolaescu Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sat Oct 27 22:32:26 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 1IlsKV-0005jM-AA for ged-emacs-devel@m.gmane.org; Sat, 27 Oct 2007 22:32:23 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1IlsKM-0007hf-Gi for ged-emacs-devel@m.gmane.org; Sat, 27 Oct 2007 16:32:14 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1IlsKJ-0007hQ-C7 for emacs-devel@gnu.org; Sat, 27 Oct 2007 16:32:11 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1IlsKE-0007hD-Sg for emacs-devel@gnu.org; Sat, 27 Oct 2007 16:32:10 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1IlsKE-0007hA-ND for emacs-devel@gnu.org; Sat, 27 Oct 2007 16:32:06 -0400 Original-Received: from tomts5.bellnexxia.net ([209.226.175.25] helo=tomts5-srv.bellnexxia.net) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1IlsKE-0007QR-AN for emacs-devel@gnu.org; Sat, 27 Oct 2007 16:32:06 -0400 Original-Received: from ceviche.home ([74.12.208.145]) by tomts5-srv.bellnexxia.net (InterMail vM.5.01.06.13 201-253-122-130-113-20050324) with ESMTP id <20071027203205.RKQD17217.tomts5-srv.bellnexxia.net@ceviche.home> for ; Sat, 27 Oct 2007 16:32:05 -0400 Original-Received: by ceviche.home (Postfix, from userid 20848) id 39A43B4AB3; Sat, 27 Oct 2007 16:32:04 -0400 (EDT) In-Reply-To: <200710271747.l9RHlQ53020242@oogie-boogie.ics.uci.edu> (Dan Nicolaescu's message of "Sat\, 27 Oct 2007 10\:47\:26 -0700") User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/23.0.50 (gnu/linux) X-detected-kernel: by monty-python.gnu.org: Solaris 8 (1) 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:81879 Archived-At: > (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