byKey and byValue: properties or methods?

Jonathan M Davis jmdavisProg at gmx.com
Thu Jan 19 12:53:13 PST 2012


On Thursday, January 19, 2012 20:56:39 Marco Leise wrote:
> I just came across some C++ code and came to the conclusion, that
> properties and indexed access should not modify the structure. In other
> words all my @property and opIndex will probably also by const. An
> exception to that being caching and access counting.

I don't know why you came to that concluson. I don't agree at all. Obviously, 
you're free to do what you want with your code, but that seems overly 
restrictive to little or no benefit. Properties can be both getters and setters 
for a reason. It would be horrible if all you had were getters.

- Jonathan M Davis


More information about the Digitalmars-d mailing list