Poll: do you use @property semantics?

Dom DiSc dominikus at scherkl.de
Sat Oct 1 14:12:35 UTC 2022


On Friday, 30 September 2022 at 13:30:31 UTC, razyk wrote:
>
> What '@property' gains or should gain over '// property'?

It gives you control over the access to a member
- you can read it (if there is a getter)
- you can write it (if there is a setter)
- you can apply operations on it that both read and write it 
(like ++ if there is both a getter and a setter)
- you cannot get its address (use function or variable if you 
want this)

- property allows you to calculate the requested value instead of 
storing it somewhere. But you can't get the address of a 
calculation (what should that be? The address of some temporary 
storage? A pointer to the stack? A pointer to the function that 
performs the calculation? But which one? The getter or the 
setter? None of those makes any sense)


More information about the Digitalmars-d mailing list