Template:Short description Template:Use American English Template:Use mdy dates

Flavors<ref>Howard Cannon, Flavors: A non-hierarchical approach to object-oriented programming, Symbolics Inc., 1982</ref> is an early object-oriented extension to Lisp developed by Howard Cannon at the MIT Artificial Intelligence Laboratory for the Lisp machine and its programming language Lisp Machine Lisp. It is notable as the first programming language to include mixins.<ref>pg 46 of Thompson, C. W., Ross, K. M., Tennant, H. R., and Saenz, R. M. 1983. "Building Usable Menu-Based Natural Language Interfaces To Databases". In Proceedings of the 9th international Conference on Very Large Data Bases (October 31 – November 2, 1983). M. Schkolnick and C. Thanos, Eds. Very Large Data Bases. Morgan Kaufmann Publishers, San Francisco, CA, 43–55.</ref> Symbolics used it for its Lisp machines, and eventually developed it into New Flavors; both the original and new Flavors were message-passing OO models. It was hugely influential in the development of the Common Lisp Object System (CLOS).<ref>"Symbolics (1985) was using New Flavors (a message-sending model, like Java today), Xerox was using CommonLoops, Lisp Machine Incorporated was using Object Lisp (Bobrow, 1986), and Hewlett-Packard proposed using Common Objects (Kempf, 1987). The groups vied with each other in the context of the standardization effort going on for Common Lisp at the time and finally settled on a standard based on CommonLoops and New Flavors." p. 108 of Veitch 1998.</ref>

Implementations of Flavors are also available for Common Lisp.<ref>Flavors for Allegro CL</ref>

New Flavors replaced message sending with calling generic functions.

Flavors offers <syntaxhighlight lang="text" class="" style="" inline="1">:before</syntaxhighlight> and <syntaxhighlight lang="text" class="" style="" inline="1">:after</syntaxhighlight> daemons with the default method combination (called <syntaxhighlight lang="text" class="" style="" inline="1">:daemon</syntaxhighlight>).

Flavors and CLOS features comparisonEdit

Flavors offers a few features not found in CLOS:

  • Wrappers
  • Automatic lexical access to slots using variables within methods.
  • Internal flavor functions, macros and substs.
  • Automatically generated constructors.
  • <syntaxhighlight lang="text" class="" style="" inline="1">DEFFLAVOR</syntaxhighlight> options: <syntaxhighlight lang="text" class="" style="" inline="1">:required-methods</syntaxhighlight>, <syntaxhighlight lang="text" class="" style="" inline="1">:abstract-flavor</syntaxhighlight>, <syntaxhighlight lang="text" class="" style="" inline="1">:mixture</syntaxhighlight>.
  • <syntaxhighlight lang="text" class="" style="" inline="1">SEND</syntaxhighlight> function for sending messages.

CLOS offers the following features not found in Flavors:

  • Multimethods
  • Methods specialized on individual objects (via <syntaxhighlight lang="text" class="" style="" inline="1">EQL</syntaxhighlight>).
  • Methods specialized on Common Lisp types (symbol, integer, ...).
  • Methods specialized on def-struct types.
  • Class slots.

TerminologyEdit

Flavors terminology
Flavors CLOS
flavor class
component flavor superclass
dependent flavor subclass
local component flavor direct superclass
local dependent flavor direct subclass
generic function generic function
combined method effective method
method option method qualifier
instance instance
instance variable slot
ordering of flavor components class precedence list

ReferencesEdit

<references/>

Further readingEdit

Template:Lisp programming language