proposal-iterator-helpers icon indicating copy to clipboard operation
proposal-iterator-helpers copied to clipboard

fixes #173: add the new intrinsics as properties of something reachable

Open michaelficarra opened this issue 2 years ago • 3 comments

Fixes #173. I really do not want to merge this, but if the committee is so inclined, this should do it.

/cc @erights

michaelficarra avatar Aug 09 '22 20:08 michaelficarra

devsnek avatar Aug 09 '22 20:08 devsnek

Actually, we probably also need to expose IteratorHelperPrototype and AsyncIteratorHelperPrototype too, sigh.

bakkot avatar Aug 09 '22 21:08 bakkot

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.

zloirock avatar Aug 10 '22 06:08 zloirock

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.

bergus avatar Sep 26 '22 23:09 bergus

Iterator.from.prototype wouldn't make sense unless new Iterator.from worked, which it shouldn't.

ljharb avatar Sep 26 '22 23:09 ljharb

@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.

bergus avatar Sep 26 '22 23:09 bergus

That's a fair counterpoint.

ljharb avatar Sep 27 '22 00:09 ljharb