(This also coincides with the point in time when static scoping was finally understood, once and for all, after a painful and embarrassing history.)
With the exception of Scheme, most Lisps don't have multi-shot continuations. They seriously complexify a language, as can be seen in weird implementation techniques like Cheney on the MTA.
It's also hard (or even impossible?) to make a good UNWIND-PROTECT in the face of multi-shot continuations. And UNWIND-PROTECT is surely one of the most important control flow operators.
So what is the common core I'm talking about? You can see it best in Dylan, I think.
First of all, a Lisp that follows this common core design can be efficiently implemented on real hardware. No need to do weird stuff like stack copying or Cheney on the MTA. In fact, Dylan has, with a bit of squinting, the same dynamic (control flow) semantics as C.
Second, the common core is simply nice to program in.
Some features of the common core:
- lexical exits
- unwind protection
- condition system with restarts
- global and lexical bindings
- first-class functions with optional, keyword, and rest parameters
- dynamic (thread-local) variables
- class-based object system
- generic functions
- powerful macros
- multiple return values
- semi-functional stateful programming style
All of them are great languages, and worth detailed study.
In the future I hope to write about each of the features these languages share in more detail.
No comments:
Post a Comment