Search                        Top                                  Index
HELP FLAVOUR                                Mark Rubinstein  September 1985

This feature is part of the flavour package.  For full details or the
package see TEACH * FLAVOURS

    flavour <name> [a <metaflavour>] [novanilla] [isa <component-1>...];
    .
    .
    endflavour;

FLAVOUR is a syntax word used for defining or altering the definition of a
flavour object, while using the FLAVOUR library.  The heading has the key
word "flavour" followed by the name of the flavour to be defined or
altered.   You can then optionally specify its metaflavour (e.g. a mixin),
the default is for the metaflavour to be flavour.  There is then an
optional keyword NOVANILLA meaning do not include the vanilla flavour as a
component flavour optionally followed by the key word ISA and a list of
names of flavour which are to be components of this flavour.  The body of
the flavour can contain method definitions (see HELP * DEFMETHOD),
procedures and declarations of instance variables.

For example the vanilla flavour is defined as:

    flavour person novanilla;
    ivars name age sex;
        defmethod birthday;
            age + 1 -> age;
            [happy birthday to ^name] =>
        enddefmethod;
        defmethod printself;
            pr('an object called '); pr(name);
        enddefmethod;
    endflavour;

Or you might want to have a flavour called student that is a sub class of
person;

    flavour student isa person;
    ivars subject tutor;
        defmethod graduate;
            [congratulations] =>
        enddefmethod;
        defmethod crawl:
            [^subject is fascinating] =>
        enddefmethod;
    endflavour;

See TEACH * FLAVOURS, and HELP * DEFMETHOD,