byKey and byValue: properties or methods?

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Tue Jan 17 09:24:59 PST 2012


On 1/17/12 11:09 AM, Michel Fortin wrote:
> On 2012-01-17 06:48:26 +0000, Andrei Alexandrescu
> <SeeWebsiteForEmail at erdani.org> said:
>
>> I hate I must ask this:
>>
>> int[string] aa;
>> foreach (k; aa.byKey) { ... }
>>
>> or
>>
>> int[string] aa;
>> foreach (k; aa.byKey()) { ... }
>
> Is it a verb? If not, it is a property.
>
> But why "by"? Why not just "aa.keys"? It's much more natural. Is "byKey"
> going to consume the associative array like "byLine" does for files?
> Obviously no. So I don't see why you need "by" here.

"Iterate collection by key".

aa.keys is taken btw.


Andrei




More information about the Digitalmars-d mailing list