Re: [go-nuts] []int does not implement []any

2022-05-12 Thread Michel Casabianca
Thank you very much Axel for this crystal clear explanation. Best regards Le mer. 11 mai 2022 à 17:56, Axel Wagner a écrit : > When you write [S []any], this means "S must have type []any". `[]int` has > type `[]int`, which is different from `[]any`, so this doesn't work - and > it can't work:

Re: [go-nuts] []int does not implement []any

2022-05-11 Thread 'Axel Wagner' via golang-nuts
When you write [S []any], this means "S must have type []any". `[]int` has type `[]int`, which is different from `[]any`, so this doesn't work - and it can't work: https://blog.merovius.de/posts/2018-06-03-why-doesnt-go-have-variance-in/ When you write [E any, S []E], you say "E must be any type a

[go-nuts] []int does not implement []any

2022-05-11 Thread Michel Casabianca
Hi gophers! This code https://go.dev/play/p/QHIxegJn3aj doesn't compile. I don't understand why. Anyone would have an explanation? And why this code https://go.dev/play/p/PCSzRkLvXhp fixes it? Thanks for your replies Best regards -- Michel Casabianca -- You received this message because you a