On 2/6/13, Jonathan M Davis <[email protected]> wrote:
> That's why some of us have suggested
> making it so that you can mark variables with @property.
What Jonathan means is this:
struct S
{
int var; // modifiable, can take address
}
Now suppose later you want to turn var into a property:
struct S
{
@property int var();
@property void var(int);
}
This potentially breaks code if the user-code was using a pointer to
the public var field in the previous version of your library.
So instead we should have the ability to annotate fields with @property:
struct S
{
@property int var; // modifiable, can *not* take address
}
There's no run-time cost, but it disallows taking the address of var,
and it allows you to introduce property functions in the future
without breaking user-code.