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.

> opDispatch can do opBinary, it's a subset.  It makes no sense to define
> opDispatch(string s)() if(s == "+") I agree, but I don't see any reason why
> opBinary(string s)() would fail to compile...

I don't get your point.  It's the compiler that decides to call
opBinary and it's only gonna decide to do so for binary operators.
Even if you pretend opBinary can accept any string.

--bb

Reply via email to