From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Vinicius Jose Latorre Newsgroups: gmane.emacs.devel Subject: Re: printing.el again Date: Thu, 18 Nov 2004 20:44:21 -0200 Message-ID: <419D25C5.8080303@ig.com.br> References: <419779C4.50909@ig.com.br> <871xew44v1.fsf-monnier+emacs@gnu.org> <41990B75.1080603@ig.com.br> <41994FFB.2060308@ig.com.br> <419C00A6.90905@ig.com.br> NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Trace: sea.gmane.org 1100818022 2112 80.91.229.6 (18 Nov 2004 22:47:02 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Thu, 18 Nov 2004 22:47:02 +0000 (UTC) Cc: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu Nov 18 23:46:48 2004 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1CUv3A-0006VZ-00 for ; Thu, 18 Nov 2004 23:46:48 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.33) id 1CUvC1-0004G2-U4 for ged-emacs-devel@m.gmane.org; Thu, 18 Nov 2004 17:55:57 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.33) id 1CUvBr-0004EZ-4P for emacs-devel@gnu.org; Thu, 18 Nov 2004 17:55:47 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.33) id 1CUvBp-0004Ds-Rq for emacs-devel@gnu.org; Thu, 18 Nov 2004 17:55:46 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.33) id 1CUvBp-0004Dh-MP for emacs-devel@gnu.org; Thu, 18 Nov 2004 17:55:45 -0500 Original-Received: from [200.221.11.57] (helo=smtp.uol.com.br) by monty-python.gnu.org with esmtp (Exim 4.34) id 1CUv2b-0000CX-SB for emacs-devel@gnu.org; Thu, 18 Nov 2004 17:46:14 -0500 Original-Received: from [200.208.40.173] (unknown [200.208.40.173]) by scorpion4.uol.com.br (Postfix) with ESMTP id DD5EE85ED; Thu, 18 Nov 2004 20:46:10 -0200 (BRST) User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8a4) Gecko/20040927 X-Accept-Language: en-us, en Original-To: Stefan Monnier In-Reply-To: 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: main.gmane.org gmane.emacs.devel:30048 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:30048 > > Well, I think it's important to know the optimizations we can use or not > > and when. > > I don't understand. *You* can't use an optimization: the byte-compiler can. Rephrasing: Well, I think it's important to know the optimizations we can SET or not and when. Like when you use gcc: gcc -O3 You set above optimization level 3. Did you understand? > > That is, if I have a code which test (featurep 'some-package) and > > some-package is not loaded, does the byte-compiler eliminate the code > > associated with this test? > > Think of it this way: any optimization should be "semantics preserving" and > should thus only affect the CPU and memory usage but not the beavior. So if > you can think of a case where an optimization induces a different behavior, > there are 3 possibilities: > 1 - this case is really outlandish and can be itself considered a bug > (e.g. someone does (provide 'xemacs)). > 2 - the case is a real problem and thus the byte-compiler does not use this > optimization. > 3 - the case is a real problem but the compiler does use the optimization, > in which case you have uncovered a byte-compiler bug and you should > report it. Consider the following code: (defun foo (arg) (if (featurep 'someone-package) (behavior-A) (behavior-B))) Does the byte-compiler "optimize" the code above? (featurep 'xemacs) is ok, because you are saying in which system all packages will run. But if you write a code to have a behavior depending on the packages that are loaded in a given moment, maybe it's not ok. So, if someone-package is not loaded, the foo is byte-compiled and the "featurep optimization" is done, the result is: (defun foo (arg) (behavior-B)) If someone-package is loaded later, then the code above will not execute as behavior-A. So, "featurep optimization" in general is not good. But (featurep 'xemacs) optimization is good. Vinicius