On Sun, 06 May 2012 22:05:20 -0400, Mehrdad <[email protected]> wrote:
Why doesn't this compile?
@property int foo() { return 1; }
@property void foo(int v) { }
void main()
{
foo |= 2;
}
It's like this in C#.
I can't decide whether I like it better in D or C#. Clearly the compiler
lowering of foo |= 2 to foo = foo | 2 would be benficial in terms of less
code to write.
But I also like having control over how properties can implement
operators. For example, the above is two function calls, but it may be
easier/more efficient written as one. The issue is, how do you do that?
The current definition syntax doesn't lend itself well to extension...
-Steve