On Wednesday, 7 September 2016 at 09:34:12 UTC, Jonathan M Davis wrote:
There are certainly some operations that we could better emulate with @property functions that currently don't work without returning by ref (like ++ or -=), but something like taking the address of the @property function simply isn't going to work in most cases, and neither is passing by ref. Basically, only stuff that can be lowered to calls to the getter and setter @property functions is going to work.

It's nice that we can have property syntax rather than having to have functions that start with get and set, but it really doesn't work to fully emulate variables.

- Jonathan M Davis

BTW, some time ago, in another thread [1] about properties, we ended up writing this wrapper [2], which does a pretty good job at simulating fields. In the original thread you can also find other variants of it.

[1] http://forum.dlang.org/thread/[email protected]
[2] http://pastebin.com/38n0fEtF

Reply via email to