byKey and byValue: properties or methods?

Jonathan M Davis jmdavisProg at gmx.com
Thu Jan 19 10:19:55 PST 2012


On Thursday, January 19, 2012 11:33:24 Andrei Alexandrescu wrote:
> On 1/19/12 11:29 AM, torhu wrote:
> > The reason would be that if it looks like field access, it should behave
> > like that.
> 
> The difficulty is in knowing where to stop. The only things that behaves
> exactly like a field access is a field access. This is a known issue in
> C++, e.g. smart pointers "are smart but aren't pointers".

Yeah. It's generally expected that properties may return stuff which is 
generated on each call. They're _simulating_ a member variable rather than 
being one. I don't think that the fact that a new value is returned each time 
is particularly relevant, especially since as long as the AA hasn't been 
altered, the returned values are equivalent.

- Jonathan M Davis


More information about the Digitalmars-d mailing list