What's the story with @property again?

Steven Schveighoffer schveiguy at gmail.com
Sun Nov 10 19:10:48 UTC 2024


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, and no new plan has ever been decided upon, so it's 
> just sat there, and since it isn't really causing issues, it 
> hasn't been a priority to figure out what to do about it. There 
> aren't a lot of people working on the language, and other stuff 
> has mattered a lot more. In all likelihood, @property will just 
> stick around as it is until someone takes the time to write a 
> DIP to do something interesting with it (and it's good enough 
> to be accepted).

So I just want to say as a side note, I've been using SDC to 
develop the new GC, and while there are a lot of missing 
features, 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.

I have to say, I quite like this, and I wish D would adopt a more 
strict version of `@property`.

I honestly think we should try a preview switch here...

-Steve


More information about the Digitalmars-d mailing list