byKey and byValue: properties or methods?
Steven Schveighoffer
schveiguy at yahoo.com
Tue Jan 24 14:34:24 PST 2012
On Tue, 24 Jan 2012 15:02:33 -0500, Andrei Alexandrescu
<SeeWebsiteForEmail at erdani.org> wrote:
> On 1/24/12 2:53 PM, Steven Schveighoffer wrote:
>> 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:
>
> I'm thinking independently of foreach, e.g.
>
> auto iter = aa.byKey/*()*/;
>
> This should clarify that iter spans aa by key.
I wrote about that.
auto iter = aa enumerate (or span) by key.
But it doesn't actually enumerate by calling that function. The
enumeration is done by iter, which is an enumerator/spanner/iterator.
FWIW, I think byKey or byValue is fine for a name. We're not writing
COBOL here, it can be shorthand. I just think they are properties, and
read in English as nouns/adjectives (not actions).
-Steve
More information about the Digitalmars-d
mailing list