On Tuesday, 21 June 2022 at 21:19:29 UTC+1 tsvihb...@gmail.com wrote: > I'm now realizing that even that wouldn't fully behave as I wanted because > it doesn't account for nil values, so I'll have to figure out a better > solution.
For a "Maybe" type specifically, the nil interface value could serve as your "None" value: https://go.dev/play/p/7mBiKbMkE4b For other union types, it's possible to use generics own union types, with a trick: https://go.dev/play/p/BKW7OQsUP5U -- 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/0db369fb-2daf-42a4-b4aa-bb67c96faeebn%40googlegroups.com.