- This is roughly the definition of a subtype: every possible value of type A is still valid under the semantics of type B, so it’s okay to coerce from A to B.
Subtypes allow information loss. E.g., losing mutability information when coercing from*Tto*const T. Losing actual alignment information when coercing from*align(64) Tto*align(1) T. Losing the actual range of values when coercing fromu32tou64.
But I agree, allowing a coercion from []T to [*]T is a bit far-fetched and unnecessary. slice.ptr feels more explicit and better to me, and I’ve actually never used this coercion, so I wouldn’t mind if it were removed.
- Comptime
[]Tis considered equivalent to[N]T, #35328 might help a bit in understanding this. The post I recently discussed about[_]Talso happens to mention the use of slices at comptime, which might eventually be used to completely replace the[_]Tsyntax.