[pro] Modularity for subclassing in Common Lisp
Pascal Costanza
pc at p-cos.net
Tue Dec 7 19:00:58 UTC 2010
On 1 Dec 2010, at 18:16, Faré wrote:
> On 1 December 2010 10:25, Daniel Weinreb <dlw at itasoftware.com> wrote:
>> First, a common base class can provide implementations of some of the
>> generic functions all by itself. My favorite simple example is an
>> "output stream" protocol, that has a write-character operation and a
>> write-string operation. The common base class provides an
>> implementation of write-string that works by iterating over the
>> characters of the string and calling write-character. Any output
>> stream that can write strings in a more efficient way can override
>> that method.
>>
> In my "pure" datastructure library (currently part of fare-utils,
> to be spun off as lil - lisp interface library), I use mixins to
> provide these "methods". So instead of adding the method to a base class,
> I would provide a mixin "write-string-from-write-char", and
> then could possibly add an opposite mixin "write-char-from-write-string",
> without creating a paradox that will byte you.
The term 'mixins' sets of my alarm bells. ;) But first a question, to better understand what you mean here: How do you reconcile the notion of mixins with multiple dispatch?
Pascal
--
Pascal Costanza, mailto:pc at p-cos.net, http://p-cos.net
Vrije Universiteit Brussel
Software Languages Lab
Pleinlaan 2, B-1050 Brussel, Belgium
More information about the pro
mailing list