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

symbol-function of non-functions



    Date: Thu 22 Jan 87 08:52:25-EST
    From: "Gail Zacharias" <GZ%OZ.AI.MIT.EDU@XX.LCS.MIT.EDU>

    The manual seems to imply that fboundp is required to return non-nil
    for macros and special forms, while symbol-function is merely allowed
    to do so (".. function or MAY be an object representing a special form
    or macro..").  Am I reading that right?

    In any case, it seem to me that these definitions make it impossible
    to tell for sure whether a symbol is a valid argument to APPLY/FUNCALL.
    I.e. in implementations which do not keep macros in the function cell,
    so that macro-function being true does not imply non-applicability of the
    symbol, there is no CL way to find out if there is an applicable definition
    regardless of whether there is or isn't a macro definition.

    Why not require fboundp be true if and only if there is an applicable
    definition.  You could still say (or (macro-function x) (special-form-p x)
    (fboundp x)) if you really want to include all possibilities, while there is no
    way to implement the more restrictive fboundp in terms of what's currently
    documented.

You seem to be assuming that Common Lisp allows a symbol to be
simultaneously a function and a macro.  It doesn't.  It only allows a
symbol to be simultaneously a macro and a special form.  Thus
macro-function being true really does imply non-applicability.

I think fboundp is supposed to mean: is this symbol globally defined as
any one of a function, a macro, or a special form, i.e. does this symbol
mean something in the car of a form in the global lexical environment?
Note that I didn't say anything about implementation in terms of
function cells, alists, or anything else.