emacs-devel
[Top][All Lists]
Advanced

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

RE: run-hooks vs. run-mode-hooks.


From: Drew Adams
Subject: RE: run-hooks vs. run-mode-hooks.
Date: Fri, 27 May 2005 09:45:40 -0700

    >   (if (fboundp 'function-in-doubt)
    >       (defalias 'mymodule-function-in-doubt 'function-in-doubt)
    >     (defun mymodule-function-in-doubt ...))
    Actually this form has the disadvantage that the
    byte-compiler would have to check which functions
    are defnied in every branch.  And snice it doesn't
    do that as of now, the byte-compiler won't noticve
    that this form does define
    `mymodule-function-in-doubt' and will hencforth
    issue warnings when you call that function.
    Better use:
       (defalias 'mymodule-function-in-doubt
         (if (fboundp 'function-in-doubt)
             'function-in-doubt
           (lambda (..) ...)))
    which makes it trivially obvious that `mymodule-function-in-doubt' will
    indeed always be defined.

Is the behavior of the byte-compiler for this kind of thing explained
somewhere? That is, are there coding guidelines somewhere to guide Lisp
users wrt the byte compiler?





reply via email to

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