unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: "Wedler, Christoph" <christoph.wedler@sap.com>
Subject: [Bug] (defun foo) during compilation defines `foo' as 0-arg `igno re'
Date: Mon, 7 Apr 2003 19:27:11 +0200	[thread overview]
Message-ID: <67B8CED503F3D511BB9F0008C75DAD6605485564@dewdfx17> (raw)

[Test using Emacs-21.2.95.1.]

If you evaluate (defun foo), you get the error
   (wrong-number-of-arguments #<subr defun> 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

             reply	other threads:[~2003-04-07 17:27 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-04-07 17:27 Wedler, Christoph [this message]
2003-04-07 19:55 ` [Bug] (defun foo) during compilation defines `foo' as 0-arg `igno re' Kai Großjohann
  -- strict thread matches above, loose matches on Subject: below --
2003-04-08 17:57 [Bug] (defun foo) during compilation defines `foo' as 0-arg ` igno re' Wedler, Christoph

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=67B8CED503F3D511BB9F0008C75DAD6605485564@dewdfx17 \
    --to=christoph.wedler@sap.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).