Why D const is annoying

Mehrdad wfunction at hotmail.com
Sat Dec 10 03:17:11 PST 2011


On 12/10/2011 3:11 AM, Walter Bright wrote:
> That's because
>
>  Matrix!(int, cast(int)1)
>
> is considered a different template instantiation (and hence a 
> different type) from
>
>  Matrix!(int, cast(uint)1)
>
> Instantiation types are based on the arguments' types, not the 
> parameters' types.
>
> If you use my suggestion for the shorthand notation, your code will 
> work as you expect.

Yup, I started using it as soon as Timon mentioned it (thanks for the 
suggestion!).
But I was referring to the bug, not to the workaround. :)  (I don't 
understand why Matrix!(int, cast(int)1) is considered a different 
instantiation, when it can't even be instantiated...)


More information about the Digitalmars-d mailing list