by tsimionescu · 4y ago · 0 comments
For example, this doesn't work [0]:
//compilation error: interface contains type constraints
func TryParse123(s string) StaticOptional[int] {
if s == "123" {
return StaticSome[int]{123}
}
return StaticNone{}
}
[0] https://go.dev/play/p/1CnieCLqESCWhich of course defeats the point of using generics
_edit: clarify that my attempt is a bad practice_