Clay language

Simen kjaeraas simen.kjaras at gmail.com
Thu Dec 30 17:23:19 PST 2010


On Thu, 30 Dec 2010 19:17:09 +0100, Max Samukha <spambox at d-coding.com>  
wrote:

> On 12/30/2010 07:08 PM, Steven Schveighoffer wrote:
>
>>
>> auto opAdd(Foo other)
>>
>> vs.
>>
>> auto opBinary(string op)(Foo other) if (op == "+")
>
> For the latter not to look so intimidating, it can be shortened to:
>
> auto opBinary(string op : "+")(Foo other)

Sadly, that shortcut does not allow for grouping. :(

Perhaps we could get a specialization for that, though:

auto opBinary( string op : "+" | "-" )( Foo other )

for instance.

-- 
Simen


More information about the Digitalmars-d mailing list