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

Re: A question



Scott Ribe <sribe@miqs.com> wrote:
> 
> Neel Krishnaswami wrote:
> > o Multiple dispatch and generic functions.
> > 
> >   [...] I can't imagine living without it; only pattern-matching
> >   from the strongly-typed FPLs is of comparable power.
> 
> Ah! Though I don't grok the fully-functional style in general, I do
> understand the patter-matching. This comment helps me a bit get a handle
> on the full extent of what multiple dispatch is good for.

There's a really excellent paper on the Cecil site which describes the
relationship very clearly. 

http://www.cs.washington.edu/homes/mernst/pubs/gud-ecoop98-abstract.html

In general, I recommend all of the Cecil papers. Cecil and Dylan feel
like they are *really* close in the design space of languages, and the
different choices that Chambers made for Cecil really shed a lot of
light on why Dylan is the way it is.

> > o Optional type annotations.
>
> Now this is one where I got really baffled. Wrote a small database front
> end. Timed some operations. Went back and added pretty complete type
> annotations. (Complete for the repeatedly-called methods.) Got a 10%
> slowdown! I know there's a reason, but I don't know what it is.

I have no idea why this would be. If you are using the Fun-Dev
compiler, you might want to talk to them about it.

> > o The hygienic macro system.
> > 
> >   As a small project, I tried adding lazy evaluation to Dylan. It took
> >   me 15 lines of code to write something that was as much part of the
> >   language as the if statement or the for-loop. (That was a project
> >   that finished a lot sooner than I expected!) The ability to extend
> >   a languge's syntactic constructs as needed is surprisingly useful.
> 
> "surprisingly useful"? That's pretty weak! How about amazing,
> incomparable, superb, mind-bending?

They are indeed extremely useful. However, I have occasionally wished
for a more powerful macro system.

One of my (currently on hiatus) projects is to implement a Warren
Abstract Machine (the standard for Prolog VMs) in Dylan so that I
could integrate/build a fast constraint system into the language, like
Screamer for Common Lisp. It's definitely feasible, but not *quite* as
cool as I'd like, because it would be nice to be able to teach the
compiler how to handle certain optimizations, and the current macro
system isn't quite expressive enough to do that.

I think it's possible to write Turing machines with macros, so they
are computationally complete. But I'd still prefer to have all of
Dylan to do metaprogramming in. :)


Neel



References: