static switch

Dominikus Dittes Scherkl Dominikus.Scherkl at continental-corporation.com
Wed Mar 5 06:54:06 PST 2014


On Wednesday, 5 March 2014 at 13:34:15 UTC, Orvid King wrote:
> Well, as long as we're talking about language design, couldn't 
> the first be improved more by allowing something like:
>
> T opOpAssign(string op : in("+", "-", "*", "/", "%", "^^", "&", 
> "|", "^", "<<", ">>", ">>>"), T)(T x)
>
> The `in` there is my attempt to disambiguate between this type 
> of constraint and what I view as the most likely syntax for 
> built-in tuples.
Also a nice idea. But a wholy new concept. "static switch" would 
be analogue to "static if", just syntactic suggar - I considered 
it only because I stumbled over the ugly "else static if()" 
chains in phobos.


More information about the Digitalmars-d mailing list