[Prev][Next][Index][Thread]

Re: Results: finished teaching one Dylan course



Edward Jason Riedy <ejr@lotus.CS.Berkeley.EDU> wrote:
> 
> (Even more off-topic: Anyone used Cecil's predicate types for real
> work?  Are they sane, or just pushing too hard on the type system?)

I've played with it, though not for a big project (the compiler is
even more experimental than d2c!). But I can state that it's
sane. It's really slick, too, because it lets you write code in a
style like pattern matching code in ML and Haskell, but with two big
advantages.

First, you "match" on the virtual type of an object rather than the
actual layout of the object like in ML, so you get the benefits of
being able to encapsulate the implementation. Second, it's extensible.
You can add methods to a generic from anywhere; you don't have to write
all the pattern matching clauses in one place, and they don't have to 
be ordered just right.

(I hear ML 2000 is going to grow a "viewtype" feature that lets you
define a set of apparent constructors for pattern matching purposes,
though. Combined with its super-keen module system the result could be
quite neat. Also, OCaml 3.0 now has keyword parameters, which makes it
just the thing to replace the Unix userland, I think.)

> But this is why I'm wondering how natural multiple dispatch, etc. is
> to beginners.  To me now, this type of object system is sensible,
> but the objects-are-packages-of-stuff made much more sense than the
> CLOS/Dylan way when I was first learning.

I don't know -- people had tried to explain multiple dispatch to me a
couple of times and it just bounced off, but when I actually started
to read Dylan code it was amazingly natural.


Neel



References: