Re: [go-nuts] Sum type experiment

2020-08-11 Thread Sina Siadat
Thanks for the link, Ian. I will have a look at it :) -- 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

Re: [go-nuts] Sum type experiment

2020-08-11 Thread Ian Davis
On Tue, 11 Aug 2020, at 3:38 PM, Sina Siadat wrote: > Hi golang-dev :) > > I was wondering what would be an idiomatic Go way > to implement a basic sum type in Go. After several > iterations I came up with 2 approaches I will share here. You may be interested in the discussions on

[go-nuts] Sum type experiment

2020-08-11 Thread Sina Siadat
Hi golang-dev :) I was wondering what would be an idiomatic Go way to implement a basic sum type in Go. After several iterations I came up with 2 approaches I will share here. (1) Group types in an interface The first approach does not require any new tools and is statically checked by Go1