Additional Binary Operators

bearophile bearophileHUGS at lycos.com
Fri Mar 1 16:20:15 PST 2013


> Maybe #* #max #min? (Also usable with a "=" prefix, #=* #=max 
> #=min).

Sorry, I meant postfix:

#*= #max= #min=

So instead of:

foo = min(foo, bar);
foo = foo.min(bar);

You write:

foo #min= bar;

(This syntax is generalizable to any diadic function. But I don't 
think D has to go there.)


An alternative syntax:

@* @max @min @*= @max= @min=

Another alternative syntax for the second multiplication operator:

auto M3 = M1 ^* M2;

Having all future D scientific libraries use the same nice and 
clean standard operator has some advantages.

Bye,
bearophile


More information about the Digitalmars-d mailing list