What is the state of @property?

rikki cattermole rikki at cattermole.co.nz
Thu Aug 25 13:27:18 UTC 2022


On 26/08/2022 1:18 AM, Andrey Zherikov wrote:
> I have no objections to deprecate `@property` attribute but I believe D 
> must support the use case when `obj.mem` expression calls `obj.mem()` 
> function (this is usually called property functions).

It already does. That is the problem!

```d
import std;
void main()
{
     S s;
     s.new_member = "foo";
     s.old_member.writeln;
}

struct S
{
   string old_member() { return new_member; }
   string new_member;
}
```


More information about the Digitalmars-d mailing list