[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Question about byte-compiler warning

From: Vinicius Jose Latorre
Subject: Re: Question about byte-compiler warning
Date: Tue, 25 Sep 2007 15:51:02 -0300
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv: Gecko/20070802 SeaMonkey/1.1.4

Stefan Monnier wrote:
Create a test file like:

((featurep 'xemacs)
 (defun bar ()
   (message "bar XEmacs"))
 (defun foo ()
 (defun bar ()
   (message "bar Emacs"))
 (defun foo ()

(defun foobar ()

Now byte-compile the file above.

The byte-compiler gives the following warning:

   In end of data:
   test.el:17:1:Warning: the following functions are not known to be
       bar, foo

But aren't these functions (bar and foo) defined using cond construct?

Why does the byte-compiler give this warning?

The byte-compiler only considers as defined a function which is trivially
obviously defined without having to do any kind of analysis.  I.e. it
doesn't look inside conditionals (or even inside `let's) to figure out what
might be defined in there.

A workaround I use sometimes is

   (defalias 'foo
     (if <toto>
         (lambda (bla) bli)
       (lambda (blo) blu)))

When the condition <toto> is used for several functions, this is a bit
inconvenient, tho.

Ok, but wasn't the construction:

  ((featurep 'xemacs)
    <xemacs-part> )
    <emacs-part> ))

recognized by the byte-compiler as a kind of conditional byte-compilation?

BTW, the byte-compiler gives no warning to the construction:

    ((featurep 'xemacs) <xemacs-part>)
    (t <emacs-part> ))))

It could also be used as an alternative construction.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]