@property needed or not needed?
Rob T
rob at ucora.com
Sun Nov 18 22:02:03 PST 2012
I can create a function that is located in a class/struct or
outside on its own without @property. If the function has the
signature of a property, i.e., void f( T x ) or T f(), I can use
it as if it is a property.
Example:
// main module
int g; // global in main module
void p(int a) { g = a; }
int p() { return g; }
main()
{
p = 7; // OK
int t = p; // OK, t = 7
}
In the example, there's no class or struct, so I assume p() is
considered to be a property of the module, which seems to make
some sense.
I also see that there's a compiler option "-property" that
currently is not recognized, but is supposed to "enforce use of
@property on property functions".
So what's up with @property? Is it being depreciated for being
redundant, or will it later be strictly enforced, or is it to be
optionally enforced through a compiler switch?
--rt
More information about the Digitalmars-d
mailing list