dynamic classes and duck typing

Steven Schveighoffer schveiguy at yahoo.com
Tue Dec 1 12:38:27 PST 2009


On Tue, 01 Dec 2009 15:06:27 -0500, Pelle Månsson  
<pelle.mansson at 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?

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...

-Steve



More information about the Digitalmars-d mailing list