How would shallow generators compose with lambda?
Waldemar Horwat
waldemar at google.com
Thu May 14 18:04:07 PDT 2009
Brendan Eich wrote:
> On May 14, 2009, at 1:47 PM, Waldemar Horwat wrote:
>
>> This whole thing is another nail in the coffin of generators.
>> Generators are the root of the troublesome longjmp's which don't play
>> well with others.
>
> Are you talking about generators, or lambdas?
Generators. They cause control flow to jump around between two independent functions.
THe same problem occurs without lambdas:
function gen(arg) {
try {
yield 1;
yield 2;
} finally {
alert("Finally called up to three times?!");
}
}
That finally will be called either 1, 2, or 3 times depending on what the caller does, which violates the principle that finally is called exactly once, no matter how you leave a scope.
Waldemar
More information about the es-discuss
mailing list