tc39 / proposal-iterator.range

A proposal for ECMAScript to add a built-in Iterator.range()

Home Page:https://tc39.es/proposal-iterator.range/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Inclusive iteration semantics

waldemarhorwat opened this issue · comments

As currently specified, inclusive iteration will sometimes return the end value and sometimes not. For example, iterating from 4 to 6 in inclusive mode will return the end value 6, but iterating from 6 to 6 in inclusive mode will not return the end value 6.

This lack of regularity makes inclusive mode very awkward to use.

Interesting case, I think it is reasonable to emit 6 in 6 to 6.

Yes, it definitely should. 6 is part of the inclusive range [6, 6].