Search                        Top                                  Index
HELP DEFAULT_METHOD                         Mark Rubinstein  September 1985
                                            Updated A.Schoter, June 1991

This document refers to part of the flavours library package.  For more
details see TEACH * FLAVOURS.

Any method called DEFAULT_METHOD (as defined by *DEFMETHOD) is treated as a
special method.  If a message is sent to an instance which is neither the name
of an instance variable or of a defined method then the message
"default_method" is sent with the name of the message as argument.  A
basic version of this method could be defined as follows:

    flavour vanilla novanilla;
        defmethod default_method(message);
            mishap('UNRECOGNISED MESSAGE', [^message]);
        defmethod updaterof default_method(value, message);
            mishap('ATTEMPT TO UPDATE UNRECONISED MESSAGE', [^value ^message])

In fact, vanilla_flavour has a predefined default_method that is more
sophisticated than this.  If you send a message M to a flavour instance
that has no method for that message, then the system will attempt to
autoload a file M_messgage.p - if that attempt is successful then the
procedure defined in that file called M will be run as the method for
the message, if the attempt to autoload fails then the mishap as
described above is generated.

If you define your own default_method for any flavour then this
overrides the built-in vanilla default_method.

See TEACH * FLAVOURS for full details of the flavour package.
See also

--- C.all/help/default_method ------------------------------------------
--- Copyright University of Sussex 1991. All rights reserved. ----------