byKey and byValue: properties or methods?

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Sun Jan 22 07:27:42 PST 2012


On 1/22/12 5:57 AM, Alvaro wrote:
> El 21/01/2012 3:05, Michel Fortin escribió:
>  >>> I think byKey and byValue are oddly named, property or not.
>  >>
>  >> Give them better names and convince others. Don't choose "keys"
>  >> and "values".
>  >
>  > Well, if the best ones are already taken, I'd say "allKeys" and
>  > "allValues" would be the next best ones. And they are obviously
>  > properties.
>  >
>
> Agree with "allKeys" and "allValues" as the next best.

byXyz is in TDPL.

> IMO, the name of a property should be a a *noun phrase* (a noun possibly
> with modifiers, complements, adjectives...) because it represents a
> thing. And if the property represens a collection of things (an array, a
> list, a range,...) that noun should be *plural* (giving the idea that it
> can be enumerable). "allKeys" follows this guideline (plural noun with a
> complement).

torhu convinced me byXyz can't be properties. I'll operate the change soon.

> 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".


Andrei


More information about the Digitalmars-d mailing list