DIP28, on properties, availabel for destruction as well

Chris Cain clcain at uncg.edu
Wed Feb 27 19:27:30 PST 2013


On Thursday, 28 February 2013 at 02:56:40 UTC, deadalnix wrote:
> Additionally, I don't think this is really a problem as it is 
> asking to break the abstraction, plain and simple. If you need 
> a function pointer, then it is likely that you shouldn't be 
> using a property in the first place.

+1. Properties (from what I've seen) are suppose to be 
effectively indistinguishable between a field. If you're taking 
the address of a property hoping to get the function address, 
this is a clear violation of that.

For instance, if I wrote some code like this:

...
auto myFun = &b.front;
...

And I expected to get a function pointer from that, it would be a 
clear violation of what ".front" means (or, is intended to 
mean...) and it would break on many ranges because many of them 
are implemented s.t. front is actually a field.


More information about the Digitalmars-d mailing list