Request: a more logical static array behavior

Maxim Fomin maxim at maxim-fomin.ru
Thu Aug 15 06:25:57 PDT 2013


On Thursday, 15 August 2013 at 12:12:59 UTC, Tommi wrote:
>
> Implicit conversion VS Implicit conversion during type deduction
> ----------------------------------------------------------------
> I don't think that you failed to see the distinction between 
> these two things, but because someone might, I'll talk about 
> this a bit more.
>
> This is regular implicit conversion (nothing weird or magical 
> about it):
>
> void foo(int[] da) { }
> int[3] sa;
> foo(sa); // implicit conversion
>
> This is implicit conversion during type deduction (totally 
> weird and magical):
>
> void foo(T)(T[] da) { }
> int[3] sa;
> foo(sa); // implicit conversion during type deduction
>

Please stop spreading this misconveption. There is *no*
conversion during type deduction. There is *a check* whether base
type of static array is same as base type of dynamic array which
happens to be true in this case. *Conversion* happens in
completely related compiler part.

And there is no special about it during template type deduction.
This (meaning that base type of int[N] array is same as base type
of int[] array) happens or could happen in any stage of compiling
proccess. How C++ does it is irrelevant to what D does.


More information about the Digitalmars-d mailing list