DIP23 Counter Proposal
deadalnix
deadalnix at gmail.com
Thu Feb 7 20:23:47 PST 2013
On Friday, 8 February 2013 at 04:06:40 UTC, Jonathan M Davis
wrote:
> 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.
>
That seems to me like one of the best proposed idea in many
thread happening on the subject.
More information about the Digitalmars-d
mailing list