D almost has concepts (lite)
TommiT
tommitissari at hotmail.com
Fri Mar 29 02:32:00 PDT 2013
On Friday, 29 March 2013 at 07:52:13 UTC, deadalnix wrote:
> That sound unimplementable, sorry.
Although, I give you that it's probably very difficult to
implement. The compiler should know all kinds of math and logic:
void fun(T)(T) if (1.5 ^^ T.sizeof >= 194 && T.sizeof != 42) { }
void fun(T)(T) if (T.sizeof ^^ 2 >= 194) { }
void main(string[] args)
{
byte[14] arr;
fun(arr); // ambiguity error
}
...if we then add a third overload:
void fun(T)(T) if (1.5 ^^ T.sizeof >= 194) { }
...the call to fun(arr) would evaluate to that one.
More information about the Digitalmars-d
mailing list