What's the story with @property again?

Dom DiSc dominikus at scherkl.de
Sun Nov 10 16:40:30 UTC 2024


On Sunday, 10 November 2024 at 11:52:30 UTC, Jonathan M Davis 
wrote:
> On Sunday, November 10, 2024 4:26:04 AM MST Alexandru Ermicioi 
> via Digitalmars-d wrote:
>> On Saturday, 9 November 2024 at 11:58:34 UTC, Jonathan M Davis
>>
>> wrote:
>> > Honestly, UFCS kind of killed most of what was planned for 
>> > @property

> In any case, the bigger problems stem from all of the various 
> things that you can do with an lvalue that you can't do with 
> getter and setter functions (e.g. taking the address of the 
> value or pass it by ref).
I want @property exactly because you cannot take the address of 
it.
For me the usecases of @property are
- protecting from modification (no setter)
- protecting from reading (no getter)
- protecting from getting the address (because: should that be 
the address of the getter or the setter? "&" should simply be 
forbidden)
- else working like an ordinary field (e.g. all operators defined 
for the field-type should work as usual).
- if you don't like that, use ordinary functions or ordinary 
fields.

Nothing of this is complicated to implement. We only need someone 
to decide: do we want this or not?


More information about the Digitalmars-d mailing list