From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: "Wedler, Christoph" Newsgroups: gmane.emacs.devel Subject: [Bug] (defun foo) during compilation defines `foo' as 0-arg `igno re' Date: Mon, 7 Apr 2003 19:27:11 +0200 Sender: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Message-ID: <67B8CED503F3D511BB9F0008C75DAD6605485564@dewdfx17> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" X-Trace: main.gmane.org 1049737403 27205 80.91.224.249 (7 Apr 2003 17:43:23 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Mon, 7 Apr 2003 17:43:23 +0000 (UTC) Original-X-From: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Mon Apr 07 19:43:21 2003 Return-path: Original-Received: from quimby.gnus.org ([80.91.224.244]) by main.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 192aeP-00074c-00 for ; Mon, 07 Apr 2003 19:43:21 +0200 Original-Received: from monty-python.gnu.org ([199.232.76.173]) by quimby.gnus.org with esmtp (Exim 3.12 #1 (Debian)) id 192ai1-0002qY-00 for ; Mon, 07 Apr 2003 19:47:05 +0200 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.10.13) id 192acU-0006o0-04 for emacs-devel@quimby.gnus.org; Mon, 07 Apr 2003 13:41:22 -0400 Original-Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.10.13) id 192aWu-0004UU-00 for emacs-devel@gnu.org; Mon, 07 Apr 2003 13:35:36 -0400 Original-Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.10.13) id 192aTS-0002Vu-00 for emacs-devel@gnu.org; Mon, 07 Apr 2003 13:32:03 -0400 Original-Received: from smtpde02.sap-ag.de ([155.56.68.170]) by monty-python.gnu.org with esmtp (Exim 4.10.13) id 192aOq-0000ho-00 for emacs-devel@gnu.org; Mon, 07 Apr 2003 13:27:16 -0400 Original-Received: from sap-ag.de (smtpde02) by smtpde02.sap-ag.de (out) with ESMTP id TAA06197 for ; Mon, 7 Apr 2003 19:27:28 +0200 (MESZ) Original-To: "Emacs-Devel (E-mail)" X-Mailer: Internet Mail Service (5.5.2656.59) X-SAP: out X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1b5 Precedence: list List-Id: Emacs development discussions. List-Help: List-Post: List-Subscribe: , List-Archive: List-Unsubscribe: , Errors-To: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Xref: main.gmane.org gmane.emacs.devel:12975 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:12975 [Test using Emacs-21.2.95.1.] If you evaluate (defun foo), you get the error (wrong-number-of-arguments # 1) If you like to have your .el files compiled without warnings, you might want to use above form just like you could use (defvar foo). OK, let's write the file bar.el: (eval-when-compile (defun foo)) (defun bar () (if (fboundp 'foo) (foo)) ; or more complicated (message "bar")) Using M-x byte-compile-file RET bar.el RET now doesn't produce any warnings. At first, you think, "hey, this is great", but then you realize, it's not so: 1. If you call (foo 2) instead (foo), you get the warning While compiling bar: ** foo called with 1 argument, but accepts only 0 2. After the compilation, evaluating (fboundp 'foo) returns t, and `foo' is defined as a 0-arg function which returns nil. While 1 is just annoying, 2 is really bad: if a package uses (defun foo), it must now mention in INSTALL s/th like "exit and restart Emacs after any compilation of the .el files". If (defun foo) would simply signal an error, we could use (ignore-errors (defun foo)) in the hope that a future Emacs would define a useful semantics for (defun foo), i.e., just like for (defvar foo). - Christoph