[pro] Modularity for subclassing in Common Lisp

Michael Forster mike at sharedlogic.ca
Tue Dec 7 16:17:33 UTC 2010


On Wed, Dec 1, 2010 at 8:29 PM, Daniel Herring <dherring at tentpost.com> wrote:
> On Wed, 1 Dec 2010, Daniel Weinreb wrote:
>
>> Smalltalk didn't even try.  CLOS, I believe, does not try and there is
>> not an idiomatic way to do it.  The only language I know that makes a
>> good stab in this direction is C++, which has "public", "protected",
>> and "private".  Whatever else you say about C++, Bjarne understood
>> this issue and tried to fix it.  The C++ solution isn't perfect
>> but it's sure a lot better than anything else.
[...]

First, my apologies.  I didn't have Dan Weinreb's original message to
respond to directly.

I disagree with Dan here.  Bjarne didn't understand the issue, and
public/private/protected are not the answer.  He, as many others have,
conflated objects with ADTs.  Worse, he exacerbated the subtyping vs.
subclassing issues with an early-bound type system.  William Cook
explains clearly the difference and its importance [1].

Gilad Bracha's Newspeak improves on the encapsulation and modularity
of Smalltalk.  More importantly, however, with no type system and a
fully late-bound approach, Newspeak supports, in its own pure OO way,
the notion of type families that early-bound ADT-oriented languages
struggled to reach.  C++, with its mixed bag of underpinnings, is
hopeless.

So, my argument would be that you can't accomplish with CLOS what
Newspeak has with classes.  Instead, you will have to treat ADT-like
encapsulation and modularity separate from that of CLOS.  That's what
OCaml had to do.  And you won't have to alter CLOS.

Cheers,

Mike


[1] http://www.cs.utexas.edu/~wcook/Drafts/2009/essay.pdf




More information about the pro mailing list