[plt-scheme] Question re: PLT object system and CLOS

From: Michael Forster (mike at sharedlogic.ca)
Date: Mon Mar 31 21:15:00 EDT 2008

Hi,

I'm evaluating the feasibility of using PLT Scheme for some of my
company's web applications.  The applications were originally
written in Common Lisp, but, as I add new features, I see where a
continuation-based web server might eliminate some of the
standard HTTP interaction baggage and better facilitate mental
flow while exploring ideas.

To keep things brief, one CL/PLT difference that concerns me
is the flavour of object systems.  I'm aware of the Swindle module,
but it seems to me, if the PLT GUI framework is any indication,
that the CLOS-like approach garners less support.  In "Scheme
with Classes, Mixins, and Traits," the authors state,

 Finally, the CLOS approach to classes is relatively popular in
 Scheme, e.g., the Meroon library [26] or Barzilay's Swindle
 library [7]. In contrast to Smalltalk-style classes, where behaviors
 are added by changing a class or deriving a new subclass,
 behavioral extensions in CLOS are attached to generic methods.
 An advantage of this approach is that it provides a clear path for
 adding "methods" to existing data types, including primitive types
 like numbers and strings. Another advantage is that it gen-eralizes
 well to multi-method dispatch, which can easily specialize an
 operation to a particular combination of classes. A major drawback
 is that it encourages an impera-tive programming style, where
 generic methods are mutated to add new class-specific
 implementations."

Indeed, our applications make heavy use of generic functions, but
define relatively few classes.  For example, we often dispatch on CL's
builtin type specifiers as well as some of our own extended ones.

So, I'm intrigued by that last statement in the excerpt above.  I'm
wondering if one of the authors or another Schemer in-the-know
could given me some examples where the CLOS approach would
lead to an imperative style and the PLT approach would not.

Thanks in advance.

-Mike

Posted on the users mailing list.