On 17-01-2012 07:48, 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
My thoughts:
The "by" in the name is way too awkward for a property. If it was just
named "keys" and "values", it would've been perfectly fine to make them
properties, but the "by" just looks awkward when you "call" them as
properties.
As far as efficiency goes, I don't think these perform any work that is
heavy enough to warrant not making them properties. (I can't say that
same for .dup/.idup... I still don't get why those are properties, at all.)
--
- Alex