tc39 / proposal-iterator.range

A proposal for ECMAScript to add a built-in Iterator.range()
https://tc39.es/proposal-iterator.range/
MIT License
487 stars 13 forks source link

Inclusive iteration semantics #38

Closed waldemarhorwat closed 4 years ago

waldemarhorwat commented 4 years ago

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.

Jack-Works commented 4 years ago

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

tabatkins commented 4 years ago

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