September 03, 2015
    pragma(msg, is(int[] : long[]));

    false


Why?
September 03, 2015
On Thursday, 3 September 2015 at 17:27:03 UTC, Jack Stouffer wrote:
>     pragma(msg, is(int[] : long[]));
>
>     false
> Why?

Think of the memory layout... if you implicitly casted, either the contents would change or it would need to allocate a new array, neither of which is free.

[0, 1] as int[] in memory is like [0,0,0,0,0,0,0,1].

[0, 1] as long[] in memory is like [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1].


It is twice as long! If you casted without the reallocation, [0,1] as int[] becomes just plain [1] as long[] - the length changes as well as the contents.