On 7/01/12 1:19 AM, Daniel wrote:
Hi, I've read on Bugzilla Issue 6398 that this is a bug:
static int value;
ref foo(){ printf("getter\n"); return value; }
ref foo(int x){ printf("setter\n"); value = x; return value; }
void main(){ foo = 1; } // Should print "setter", but print "getter" in 2.054
But, this is pretty convenient syntax, no? That way you could implement only
one function foo() and use it as setter and getter.
I'm a bit confused about it.
Thanks,
Daniel
It is convenient syntax, but sometimes you want the getter to return a
ref, but want the setter to do something different to "getter() = x".
This bug says that there is no way to override a ref returning getter
with a custom setter.