2 ms·
No it's not due to the implementation, it's due to the language specification: there is no general subtyping. You can see it this way: there is implicit syntac
by ithkuil 5y ago
No it's not due to the implementation, it's due to the language specification: there is no general subtyping.
You can see it this way: there is implicit syntactic sugar that creates an interface value (pointer + type info) when you assign a value of type T to a variable of type interface I where T implements I. This happens on variable assignment, function parameter bindings and return value bindings.
A slice of Is is just a very different type from a slice of Ts. The assignment magic sugar works, but it works at the level of slice elements, not the whole slice.
- deleted 5y ago[deleted]