how-we-work icon indicating copy to clipboard operation
how-we-work copied to clipboard

Normative Conventions: pretend primitives aren't iterable

Open michaelficarra opened this issue 1 year ago • 2 comments
trafficstars

We discussed this in the June plenary while considering iterator helper follow-on proposals. While we didn't call for consensus on it, there were many voices in support of this and none opposed. I will propose we officially adopt it at an upcoming plenary.

michaelficarra avatar Jun 19 '24 00:06 michaelficarra

I think we could probably get away with also changing Iterator.from to reject primitives.

michaelficarra avatar Jul 03 '24 20:07 michaelficarra

Iterator.from is a coercion method, so its input type should be looser. We specifically discussed that exact question, including in plenary.

bakkot avatar Jul 03 '24 20:07 bakkot

Possibly worth calling out that this applies to async-iterable-taking positions as well.

bakkot avatar Jul 17 '24 03:07 bakkot

@syg I've added the enumeration of all positions where primitives are currently iterated. Please review.

michaelficarra avatar Aug 02 '24 00:08 michaelficarra