DIP23 Counter Proposal

Jonathan M Davis jmdavisProg at gmx.com
Thu Feb 7 20:06:28 PST 2013


On Thursday, February 07, 2013 22:19:53 Dan wrote:
> On Thursday, 7 February 2013 at 21:05:49 UTC, Robert wrote:
> > You missed the point. When this gets lowered to accessor
> > functions and a
> > private variable, you ensure that you can later on add your
> > magic soup,
> > without breaking code that relied on i being a real field.
> > (E.g. taking
> > the address, using +=, -=, ...)
> 
> Quite likely I missed the point.
> Today I have:
> struct S
> {
> @property int i;
> }
> 
> 
> Tomorrow I decide I need to track every time int i is read and
> written.
> How is that done?
> I assume that that sort of encapsulation is what we are after.

You rewrite it as explicit property functions. No code breaks, because it was 
really property functions all along. You just didn't have to type them.

- Jonathan M Davis


More information about the Digitalmars-d mailing list