proposal-iterator-helpers
proposal-iterator-helpers copied to clipboard
fixes #173: add the new intrinsics as properties of something reachable
Fixes #173. I really do not want to merge this, but if the committee is so inclined, this should do it.
/cc @erights
Actually, we probably also need to expose IteratorHelperPrototype and AsyncIteratorHelperPrototype too, sigh.
I'm against this since it's inconsistent with all the rest iterator prototypes. In this case, at first, all the rest existing iterator prototypes, like ArrayIteratorPrototype
, should be exposed.
There are intrinsic those cause problems when they are not exposed, like AsyncGeneratorPrototype
, that can be accepted only with the usage of specific syntax, but it's not this case.
Now it can be accepted like all the rest iterator prototypes, in the future "Get Intrinsic" proposal will help to solve it without invocation of methods.
Please, don't add more chaos and inconsistency to the language.
If these were to be exposed, why not just as Iterator.from.prototype
, AsyncIterator.from.prototype
, Iterator.prototype.map/filter/….prototype
? That would at least be consistent with the rest of the language and how generator functions work.
Iterator.from.prototype
wouldn't make sense unless new Iterator.from
worked, which it shouldn't.
@ljharb Why not? new (function*() {})
doesn't work either, but (function*() {}).prototype
exists to denote the prototype of the generator produced by calling the function.
That's a fair counterpoint.