Skip to content

Instantly share code, notes, and snippets.

@bozdoz
Created November 6, 2022 14:57
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Embed
What would you like to do?
exclusive_enums.go
package main
type dessert int
const (
ICE_CREAM dessert = iota
CUP_CAKES
GUMMY_WORMS
)
type exclusive_dessert interface {
ignore_me()
}
func (d dessert) ignore_me() {}
// now use exclusive_dessert
func use_dessert(d exclusive_dessert) {}
// use_dessert(0) doesn't work!
// must use use_dessert(ICE_CREAM)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment