byKey and byValue: properties or methods?

Era Scarecrow rtcvb32 at yahoo.com
Tue Jan 24 13:43:33 PST 2012


> >> 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:

 Perhaps I'm out of line, and I haven't looked much at the class/struct specifically in question (Actually I have no clue which one your talking about), but I would wonder one thing. Would it be read/write or just read-only? If it's read-only, I would think there would be no harm in having it as a property.

 A second thought, is would there be any benefit having it as a method, specifically passing the address as a function rather than just getting the return value (From what I can tell that's unlikely).

 I'll vote property.


More information about the Digitalmars-d mailing list