Detecting a property setter?

Jonathan M Davis jmdavisprog at gmail.com
Mon Jul 19 14:48:12 PDT 2010


On Monday, July 19, 2010 14:37:22 Rory McGuire wrote:
> I suppose it would be seen as a bug because it possibly circumvents the
> getter/setter
> philosophy (If you return the internal value anyway).

No, the problem is that you have _both_ a getter returning a ref and a setter. 
So, which does the compiler use? Returning a ref isn't a problem - phobos does 
it with ranges. Doing that, you basically user the getter for setting the 
property also. However, with both a getter returning a ref and a setter, then 
the compiler is going to have to choose which to use if you use the property as 
a setter. It's an ambiguity and thus shouldn't compile. If it does, then that's 
a bug.

- Jonathan M Davis


More information about the Digitalmars-d-learn mailing list