>
>
> // the same, advancing to the first `yield` at instantiation
> class echo2 extends echo {
> construct(...args) {
> let iter = super(...args)
> iter.next()
> return iter
> }
> }
>
Nice pattern! Would this also work?
var skipFirst = genFn => function*(...args) {
var iter = genFn(...args);
iter.next();
yield * iter;
};
var echo2 = skipFirst(echo);
If we have decorators, then we can write:
@skipFirst
function echo() { /*_*/ }
which is fairly pleasant.
Still, it seems like we're papering over a hole. In principle, why
shouldn't we be able to access the first next argument?
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss