-
Notifications
You must be signed in to change notification settings - Fork 13
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Normative: Prefix RangeIterator with Numeric #46
Conversation
Why “numeric”? What other kind of range would be implied? What does “isInclusiveEnd” mean versus “isInclusive”? |
The
|
Are those plausible? |
If we're going to have String ranges in the future, we won't collide the name.
It means, the property only indicates the end is inclusive or not. The start is always inclusive |
I don't know, but I can conceive of them. However, if I wanted to range over some ordered type, one approach would be to map a suitable range of numbers; for example let animals = Number.range("🐀".codePointAt(), "🐉".codePointAt(), {inclusive: true}).map(String.fromCodePoint);
for (let animal of animals) console.log(animal); // 🐀 🐁 🐂 🐃 🐄 🐅 🐆 🐇 🐈 🐉 which could conceivably be written as let animals = String.range("🐀", "🐉"); // function might also accept an optional `Intl.Locale` or `Intl.Collator`
for (let animal of animals) console.log(animal); // 🐀 🐁 🐂 🐃 🐄 🐅 🐆 🐇 🐈 🐉 Perhaps those prototypes are unnecessary; even if they are conceivable. |
|
@devsnek i don't see how, would that include |
@ljharb in the event I propose String.range I'll answer that question :) |
I'll revert the rename on |
To restate: i don't think any non-numeric ranges are viable, and i think the "numeric" prefix is unnecessary. |
Why not? Why can't we have a "Temporal" range like |
Temporal.Duration already exists, there’d be no need for it on Temporal itself. |
…in `{ Number, BigInt }.range` iterator tc39/proposal-iterator.range#46
RenameRangeIteratorPrototype.inclusive
toRangeIteratorPrototype.isInclusiveEnd
.(This is not related to #44 or #45, not affecting the main API shape but do observable)