What's the story with @property again?

Steven Schveighoffer schveiguy at gmail.com
Wed Nov 13 19:05:07 UTC 2024


On Wednesday, 13 November 2024 at 16:44:53 UTC, Nick Treleaven 
wrote:
> On Sunday, 10 November 2024 at 19:10:48 UTC, Steven 
> Schveighoffer wrote:
>> one thing that SDC has implemented is enforcement of 
>> `@property` syntax. That is, if a function is labeled 
>> `@property`, then `&obj.member` gives you an address to the 
>> return of the property, and `obj.member()` would not be valid 
>> unless the return value was a callable.
>
> Does it also disallow `writeln = "hi";`? That should be made an 
> error IMO.
> https://issues.dlang.org/show_bug.cgi?id=17474

I'm unsure, as I haven't tried.

But the point of this wasn't really to say that what SDC does is 
what we should implement in D. The point was to say, this one 
aspect of property enforcement I have been forced to use while 
implementing the GC, and I quite like it. Instead of a hypothesis 
of "yes, I think I would like it if we did this", I can say "I 
like it, and I have experience liking it".

-Steve


More information about the Digitalmars-d mailing list