some generator issues
Yuh-Ruey Chen
maian330 at gmail.com
Tue Apr 24 11:48:36 PDT 2007
Neil Mix wrote:
> On Apr 23, 2007, at 1:18 PM, Brendan Eich wrote:
>
> > A static method would avoid the shadowing problem you raised. It
> > would reflect on the current call stack, presumably finding the top-
> > most generator activation, and extracting the generator-iterator
> > reference (which generally must be kept somewhere reachable from
> > that activation, to keep the generator-iterator alive). It seems
> > slightly more winning to me, but still leaves an odd taste. Thoughts?
>
> It seems inconsistent that the current generator would be fetched via
> a static method on the Generator class, while the current function
> would be fetched via arguments.callee. Perhaps that's an argument
> for deprecating arguments.callee in favor of a static method on the
> Function class? So we could have a consistently odd taste.
>
I agree. If the current generator is accessed via a static method, then
the same should apply to the current function accessor, especially if
you intend to deprecate |arguments| in the future. The syntax is rather
un-ES like, but if |arguments| is out of the picture, then it's better
than introducing a new keyword.
More information about the Es4-discuss
mailing list