[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Continuations
The best way to understand what continuations are all about is to look at
an interpreter that uses them.
When I read the first Scheme paper I had no idea what Sussman and Steele
were talking about with their `catch' expression. But in an appendix to
their paper they included a Scheme interpreter (written in MacLisp -- a
language I already knew), and by the end of the day I understood
completely.
Anyone who wants to explain continuations to the massses should sit down
and write an interpreter (in some language that the masses are familiar
with) for a simple language with a `catch' expression.
Don't Perl or Java programmers ever write interpreters? All these things
that people seem to have so much trouble with, like first-class procedures
and continuations, are really easy to understand once you see how they can
be implemented in a page or two of code. No analogies about six-year-old's
rooms needed. No scary mathematics required. All your questions answered
in simple concrete operational terms.
OK, so Lisp-family languages have always had an advantage when it comes to
this kind of explanation-by-interpreter: when you write a Scheme
interpreter in MacLisp you don't need to spend a lot of time writing a
parser. So maybe you'd have to spend another page or two of code on
parsing some simple programming language notation into suitable data
structures, but nobody would really need to understand how that part works
internally.
- Alan