On Jan 14, 2012, at 6:46 PM, Brendan Eich wrote:
> Adding escape continuations is another case of warty + shiny ~~~> shiny
> promised land hope as the evolutionary game we have to play on the web.
> Still, I'm in favor of escape continuations but I do not want to bundle them
> with block-lambdas. One mountain to climb at a time.
With block lambdas that support the return statement we already have escape
continuations:
function callWithEscapeContinuation(blockWithOneArg) {
let escapeContinuation = {|value| return value};
return blockWithOneArg(escapeContinuation);
}
result = callWithEscapeContinuation( {|escape|
...
if (cond) escape();
...
};
...
I used the Smalltalk equivalent [:v| ^v] all over the place in the
implementation of the Smalltalk resumption-based exception handling system. In
fact, with block lambdas and try-finally (not no catch). I could replicate
the full Smalltalk-style EHS in JavaScript. (Not to argue that resumable
exceptions are really that good of an idea).
Allen_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss