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

two questions about New Flavors

    Date: Thursday, July 3, 1986  11:09:14
    From: Alan Snyder <snyder%hplsny@hplabs.HP.COM>

    Sorry to wake everybody up, but I have a couple of questions about New Flavors
    that I thought might be of general interest.

Oh that's all right, I was kind of nodding off.

    1. How does one update Old Flavors code that uses keyword method names?  Does
    New Flavors allow generic functions with keyword names?

New Flavors as implemented by Symbolics includes virtually full
compatibility with the past.  This means updated Old Flavors code
can continue to use message passing (SEND) just as it did before.  I
consider all this to be a compatibility feature to ease transition for
our users, not an inherent part of the New Flavors language.  Other
implementations of New Flavors might choose to omit message passing,
in which case one of course could not import old code that uses message
passing.  In discussions with the Common Lisp community I have tended
to downplay the compatibility features because I don't think they
are interesting in their own right.

Of course it's legal to defun a keyword as a function, but in practice
nobody ever does that (as far as I know).

    2. Does New Flavors have any notion of a default handler for Undefined
    Methods?  In other words, does an invocation of an undefined function get
    turned into an invocation of a generic function with the function name
    as an argument?

Functions only become generic functions if you either define them
explicitly by evaluating a DEFGENERIC or define them implicitly by
evaluating a DEFMETHOD (neglecting other implicit definitions such as
:READABLE-INSTANCE-VARIABLES).  This means that if you call an undefined
function that nobody ever heard of, that's an ordinary undefined
function and it does whatever error processing your Lisp normally does.
In fact the error handling system turns this into the signalling of a
condition, which could be handled by the dynamic state of the program
(not by one of the arguments to the function).  If, on the other hand,
you call a function that has been explicitly or implicitly defined to be
a generic function, then it's defined and it dispatches on the type of
whatever argument(s) you defined it to dispatch upon.  If no method is
defined, that's an error in its own right, which in fact does turn into
the invocation of a generic function with the original function (I think
it's the function definition rather than the function name) as an argument.

Another way of saying this is that Flavors is not Smalltalk -- it does
not replace the entire Lisp system in which it is embedded with a fully
object-oriented system; you still have your choice of functional or
object-oriented style.