Future of memory management in D
Dom DiSc
dominikus at scherkl.de
Fri Nov 19 11:32:29 UTC 2021
On Friday, 19 November 2021 at 11:14:46 UTC, Dom DiSc wrote:
> prop += 5;
>
> is automatically lowered to
>
> prop(prop() + 5); // function style
And btw. taking the address of a property (the whole point why
this feature was abandoned which would otherwise be very easy to
implement) should simply be forbidden also.
What should that be anyway? The address of the getter? Or that of
the setter? Or that of the private member (that may not even
exist)?!?
Properties simulate a value but protect it by allowing only
specific operations on it (either get or set or both, but maybe
with complicated processing of the assigned value).
Why should it allow such an immersive operation as taking its
address?!?
If at all, we may allow for a third property function, that
simulates an address of a value - but I can't think of a valid
usecase for such a thing... through the address you can do
everything to the simulated object, so why not making it public
in the first place?
More information about the Digitalmars-d
mailing list