|
Dylan's semantic core, like Scheme's and some of ML's, is actually
based on the lambda calculus. This is a very pristine model of
computation (similar to a Turing machine), but the power seems to lie
very close to the surface.
Dylan restricts the use of one very powerful Scheme feature:
continuations. Consider the following code:
block (return)
return(3);
end;
In this example, 'return' is a first class function. You can pass it
subroutines, store it in global variables and call it any time before the
block exits:
define function
look-for-something (exit-procedure) => ()
exit-procedure(3);
end;
block (exit-procedure)
look-for-something(exit-procedure);
end;
Now, in Scheme, you're allowed to do some really scary things. In
particular, you can store 'exit-procedure' externally and call it *after*
the block has already exited once. This lets you implement any known
control structure, including Prolog backtracking and even goto. But
Dylan doesn't allow this--once you leave the block, the results of
calling its exit function are undefined. This tends to keep me out of
trouble. ;-)
|