Closed Jack-Works closed 3 years ago
Please, no. It's like moving Array#keys
to Iterator.arrayIndexNumberIterator
.
Please, no. It's like moving
Array#keys
toIterator.arrayIndexNumberIterator
.
Interesting point, let me consider this
Why would it need "iterator" in the name? keys
/values
/entries
/matchAll
are all functions in the language that provide an iterator, and nobody's seemed confused by those.
Why would it need "iterator" in the name?
keys
/values
/entries
/matchAll
are all functions in the language that provide an iterator, and nobody's seemed confused by those.
So I have heard a point (maybe from @hax) that most of the built-in methods that return an iterator are not configurable via option bags. But this one is different. (Oh so matchAll
is the same case as range
)
I also don't know why an options bag would make a difference, unless you're suggesting that an option would be able to change the return type of the function, which I'd find very confusing and problematic.
Another difference is keys/values/entries/matchAll are prototype methods and range is not. π€
Why would the placement of a method create confusion about the return type? Reflect.enumerate
, before it was removed (due to not being a proxy trap), was a static method that returned an iterator.
Hmm, that makes sense to me. I need to consider more about this. Let me close this for now.
Another question. Are people here (and in #42) are good with the status quo?
I don't think any modern languages put the types in method names π¬
So per discussion in #42 I think most people do not comfortable with class. I'm not OK to ship Number.range without hinting it is an iterator in the name so I'm going to rename this proposal.
Requirements:
Example:
Number.rangeIterator
orIterator.numericRange
(unify all kinds of numbers, bigints, ...etc) orIterator.numberIterator
+Iterator.bigintIterator
.Number.range
To avoid the embarrassment if we want to add things like String ranges, Temporal ranges (maybe we do have it?), or other kinds of ranges, the name must include
number
,bigint
ornumeric
(if merge number and bigint into one API).Iterator.numericRange
Iterator.range
=======================================
Though I strongly want to hint at both "iterator", "range", and "number" in the API name, I'm worrying if it will hurt the egenomics because the name is too long. Maybe it is not a problem because all modern IDEs and debuggers will provide completion for the API so it is not a problem? I don't know.