Hallöchen!

'Axel Wagner' via golang-nuts writes:

> [...]
>
> The two signatures really mean completely different things. Writing
> `func do[S []E, E any]` really means "S has type []E, where E can be
> any type", which is a very different thing from saying "it's a slice
> of the specific type any".

This is true of course but in my head it is easier to consider
instantiation of a generic function as an extra intermediate step,
so that the compiler never sees []any but []float64 directly (as
function parameter type).

Then, all boils down to the fact that you can’t pass []float64 as an
[]any.  To be honest, I still don’t fully understand why this is
forbidden, so I just accept that the language does not allow it.

Thanks to both of you!

Regards,
Torsten.

-- 
Torsten Bronger

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/87il7dni96.fsf%40physik.rwth-aachen.de.

Reply via email to