between and among: worth Phobosization?

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Tue Dec 17 10:10:25 PST 2013


On 12/17/13 7:52 AM, Simen Kjærås wrote:
> On 17.12.2013 15:36, Marco Leise wrote:
>> Now similarly I would prefer if among() could do anything else
>> but shift indexes by +1. Indexes in D are 0 based. Since we
>> are talking about a verbatim set of options here instead of a
>> linear string, I could live with -1 as "not in list" and a
>> zero based index, but then among would have to be renamed to
>> something that doesn't imply a result that converts to boolean.
>> "optionIndex" or something.
>
> findAmong? I find 'among' ambiguous - both a boolean result and an index
> result would fit the name, IMO.

I prefer "among". It's a convenience function. The longer the less 
convenient.

Andrei



More information about the Digitalmars-d mailing list