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

RE: Continuations



Dan Sugalski wrote:
> At 4:12 PM -0400 8/8/03, Alan Bawden wrote:
> >Don't Perl or Java programmers ever write interpreters?
>
> Rarely. These days almost *nobody* writes interpreters.

I agree, based on what I've seen.

> But, then almost nobody ever has. In the past there were just fewer
> people overall, so almost nobody was a larger percentage of the
> population.

That doesn't address why so few people write interpreters.  I'll speculate:

1.  Most programmers don't know why they should want to write an
interpreter.
2.  Most programmers think writing an interpreter must be very difficult.
3.  Many mainstream languages don't make it easy to write interpreters.
4.  By (3), most programmers are correct about (2).
5.  Mainstream languages that do make it easier to write interpreters tend
to be languages like Perl or Python, which are already interpreters.  An
interpreter implemented in an interpreted language is correctly perceived as
being likely to be very slow, and thus seems like a dead end to most
programmers, who by (1), don't know that it might make sense to write an
interpreter just as a learning experience.

I think it can reasonably be argued that the "average" programmer does, in
fact, have little reason to want write an interpreter.  But the same isn't
true for an "above average" programmer.  I'd argue that too few
above-average programmers write interpreters, because of the above factors,
but also because of this one:

6.  Most programmers have very little by way of accessible resources to
teach them how to write an interpreter.  For most programmers, books like
SICP, HtDP and EoPL are not accessible resources.  Even though an above
average programmer might be capable of understanding them, they tend to be
too far removed from what those programmers are familiar with, and require
too much commitment for an uncertain payoff - speaking from the perspective
of the programmer who doesn't quite know what he's going to get out of
learning a foreign programming language and slogging through books written
in a foreign semi-formal language.  This is not a critique of those books,
it's just that they don't necessarily extend all that far beyond the target
audience for which they're designed, i.e. students at academic institutions.

More accessible resources include some of the sorts of books and magazines
you find in retail bookstores, and articles on popular developer's web
sites.  I suspect a series of articles about how to implement interpreters
in mainstream languages could spark some interest and spread some useful
knowledge, *but* the articles would have to do a good job of motivating the
activity with applications that go beyond learning about e.g. continuations.

It's possible that above-average programmers might be appealed to by the
sheer joy of learning and the prospect of gaining knowledge that could be
indirectly useful, but I suspect if that were the only motivation, it would
seriously restrict the audience.  Explaining that implementing interpreters
allows one to implement domain-specific languages is unlikely to help much,
because most programmers don't think explicitly in terms of solving problems
by implementing DSLs, and so that whole concept would first need to be
motivated.

I'm rambling like this because I think it's a pity that this sort of
knowledge isn't a little more widespread.  I think the status quo reflects
the fact that above-average programmers who have not been exposed to modern
academic computing science, are unnecessarily constrained by the "Teach
yourself Java in 21 days" atmosphere of the mainstream programming world.
There's very little by way of bridges between that world and the world to
which SICP is one of the doorways.  (This list being a welcome exception, of
course!)

Anton