|
|
|
|
|
by tsimionescu
1521 days ago
|
|
Well, that doesn't really work, as "StaticOptional[T]" can't be used as the type of a variable. It can only be used to create another generic function. 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/1CnieCLqESC |
|