On Wed, 02 Dec 2009 00:01:41 +0300, Bill Baxter <wbax...@gmail.com> wrote:
On Tue, Dec 1, 2009 at 12:38 PM, Steven Schveighoffer
<schvei...@yahoo.com> wrote:
On Tue, 01 Dec 2009 15:06:27 -0500, Pelle MÃ¥nsson
<pelle.mans...@gmail.com>
wrote:
Steven Schveighoffer wrote:
Isn't opBinary almost identical to opDispatch? The only difference I
see is that opBinary works with operators as the 'symbol' and
dispatch works
with valid symbols. Is it important to distinguish between operators
and
custom dispatch?
-Steve
opBinary is a binary operator, opDispatch can be anything. I think they
should be kept separate.
You could say the same thing about dynamic properties. How come we
don't
split those out as opProperty?
That's because of what Andrei pointed out: &a.b .
The compiler can't tell if you want a delegate to the method b, or the
address of a property b.
Technically, you are wrong. There is the same ambiguity without function
overloads:
void foo(int a);
void foo(float a);
auto dg = &foo; // which one of the two overloads is chosen and why?
Resolving properties is much easier: property and function names can't
overlap, i.e. you can't have property *and* any function with the same
name.