Additional Binary Operators

H. S. Teoh hsteoh at quickfur.ath.cx
Fri Mar 1 16:36:07 PST 2013


On Sat, Mar 02, 2013 at 01:31:19AM +0100, Era Scarecrow wrote:
> On Friday, 1 March 2013 at 23:29:43 UTC, Paul D. Anderson wrote:
> >
> >My bottom line is the need to define at least one more product
> >operator. I only propose adding it to the core language because I
> >can't find a way to make it happen in a library. I am open to
> >suggestions.
> 
>  I'd say a DSL for the scientific library would be best, likely as a
> mixin, then the text could be processed and use it's own rules and
> replace symbols with function calls?
> 
>   //can mix regular operations and utf extras
>   a = scientificCalc!"(s * 4) × 4"(s);      //possible call formats?
>   mixin(scientificCalc("a = (s * 4) × 4"));

+1. With D's compile-time capabilities, DSLs give you arbitrarily
complex custom syntax at essentially zero runtime cost. You can even
implement compile-time DSL optimizers that produce optimized code like
no overloaded operator ever can.


T

-- 
Who told you to swim in Crocodile Lake without life insurance??


More information about the Digitalmars-d mailing list