> That's one of these D myths as far as I'm concerned. It's still ambiguous,
> consider (Y) ! x, is that a type cast plus a unary ! operator or a generic
> instantiation?
it's not ambiguous.
void fun(T)(int a){}
void main(string[]args){
(fun)!double(3); // Error: C style cast illegal, use cast(fun)!double(3)
}
Run
from the horse's mouth: <https://dlang.org/articles/templates-revisited.html>
> There's got to be a better way. D solves it by noticing that ! is not used as
> a binary operator, so replacing: `a<b,c>` with `a!(b,c)` is syntactically
> unambiguous. This makes it easy to parse, easy to generate reasonable error
> messages for, and makes it easy for someone inspecting the code to determine
> that yes, a must be a template.
>
> (Plus the syntax is ugly.)
that's entirely subjective, and I'll take an ugly solution (which it's not) any
time over an ambiguous one.