byKey and byValue: properties or methods?

Steven Schveighoffer schveiguy at yahoo.com
Tue Jan 24 11:53:57 PST 2012


On Sun, 22 Jan 2012 10:27:42 -0500, Andrei Alexandrescu  
<SeeWebsiteForEmail at erdani.org> wrote:
>
>> byKey is what, an adverb phrase, an adjective phrase? It can't name a
>> range which is a thing.
>
> It has the implied verb "enumerate", "span". "Span hashtable by key".

Actually, it's for each (x) in (y) by key:

foreach(i; aa.byKey);

The verb is not implied, nor should it be:

for each (x) in (y) enumerate by key.

This doesn't read well...  But...

for each (x) in (y) enumerated by key.

Hm... still not an action.  It's not a noun, but looks more like an  
adjective (not an english major).

Even if you don't use it via foreach:

auto x = aa enumerate by key.

The call itself didn't *actually* enumerate the values, it just got you an  
enumerator.

Still vote property, but I see it's unlikely to change your opinion.  Oh  
well, back to the winnable battles :)

-Steve


More information about the Digitalmars-d mailing list