--
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...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/87bkd7nern.fsf%40physik.rwth-aachen.de.
--
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...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/87bkd7nern.fsf%40physik.rwth-aachen.de.
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...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/87il7dni96.fsf%40physik.rwth-aachen.de.
'Axel Wagner' via golang-nuts writes:
> [...]
>
> What would this do?
>
> func F(s []any) {
> s[0] = "Foo"
> }
> func main() {
> s := []int{1,2,3,4}
> F(s)
> fmt.Println(s)
> }
I think most intuitive would be if this behaved as an implicit
instantiation of the function with the type passed to it.
> 'Axel Wagner' via golang-nuts writes:
>
> > [...]
> >
> > What would this do?
> >
> > func F(s []any) {
> > s[0] = "Foo"
> > }
> > func main() {
> > s := []int{1,2,3,4}
> > F(s)
> > fmt.Println(s)
> > }
>
> I think most intuitive would be if this behaved as an implicit
> instantiation of the function with the type passed to it.
Anyway, I mean
instantiation of F with a concrete type before the actual
compilation step. The same thing already happens if you write F[T
[]E, E any](s T).