Hi,
Would it be less confusing to extend the behavior of #entries, instead,
like this:[0,1,2,3,4].entries(1,3) #==> [1,3]
or would this lead to the same problems as with overloading #select?
To avoid repeating same disuccsion again, let me summarize:
We want to have a new method to replace “indices”, because of
inconsistency between “indices” (or “indexes”) and “index”. “index”
returns index of a value, “indices” returns values corresponding to
indices.
A new method (say “quux” for example) should satisfy
-
obj.quux(a,b,c) returns [obj[a],obj[b],obj[c]] for all indexable
collections (i.e. Array, Hash, MatchData and Struct), perhaps
except for String, which is mere string of characters rather than
indexable collection. So preferably it should sound natural both
for arrays, hashes and others. -
obj.quux() either returns an empty array or causes exception, due
to the case like obj.quux(*ary) where ary is an empty array.matz.
···
In message “Re: select and select” on 02/09/20, Joel VanderWerf vjoel@PATH.Berkeley.EDU writes: