byKey and byValue: properties or methods?

Alix Pexton alix.DOT.pexton at gmail.DOT.com
Sat Jan 21 02:26:04 PST 2012


On 20/01/2012 17:58, Andrei Alexandrescu wrote:
> On 1/17/12 12:48 AM, Andrei Alexandrescu wrote:
>> I hate I must ask this:
>>
>> int[string] aa;
>> foreach (k; aa.byKey) { ... }
>>
>> or
>>
>> int[string] aa;
>> foreach (k; aa.byKey()) { ... }
>>
>>
>>
>> Thanks,
>>
>> Andrei "I told you" Alexandrescu
>
> I tallied the votes.
>
> Function: Mail Mantis, bearophile, Jacob Carlborg, Olivier Pisano, Ary
> Manzana, torhu.
>
> Property: Nick Sabalausky, Simen Kjaeraas.
>
> I wasn't able to discern a clear vote from the others. Please correct
> the list.
>
>
> Thanks,
>
> Andrei

I vote property.

While the names do not fall in line with the properties-are-nouns 
pattern, I do see the compound aa.byKey as a noun (especially when aa is 
something more meaningful, and preferably plural). So I think the names 
should stay as they are.

A...


More information about the Digitalmars-d mailing list