byKey and byValue: properties or methods?

Michel Fortin michel.fortin at michelf.com
Tue Jan 17 09:09:29 PST 2012


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.

-- 
Michel Fortin
michel.fortin at michelf.com
http://michelf.com/



More information about the Digitalmars-d mailing list