Go generics: type constraint for function or (non-type constraint) interface?

133 views
Skip to first unread message

TheDiveO

unread,
Sep 28, 2022, 3:05:23 PM9/28/22
to golang-nuts
Is there currently a way in Go generics to express a type constraint to allow only
- any function
- any interface that isn't a type constraint, such as ~int
?

Axel Wagner

unread,
Sep 28, 2022, 3:12:16 PM9/28/22
to TheDiveO, golang-nuts
No and no.

--
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/16b6413d-fd37-4f37-8c42-7665764a465bn%40googlegroups.com.

TheDiveO

unread,
Oct 9, 2022, 4:10:11 PM10/9/22
to golang-nuts
Thank you! I was already expecting a twin no, but wanted to ensure that I didn't had overlooked something.
Reply all
Reply to author
Forward
0 new messages