Hey! I would like to join the discussion and add my 5 cents here, since I
have been criticizing the contracts draft and I would like to show what
were my points in order to support the current design draft.
I believe the original problem for the generics is to allow the same
function to
It all sounds now reasonable. Thanks for the attention. Good job!
--
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
Both
type X int | string
and
type X interface int, string
Are meant to be a syntax sugar for:
type X interface {
type int, string
}
It is not a sum type, but rather a generic type that needs to be
instantiated before the use. That is why it cannot have a zero value:
var x X // error, X
Hey! The new draft is way better than previous, but it still allows to write
some tricky code.
func String(type T fmt.Stringer) (x T) string {
return x.String()
}
This is not really a good type parametrization example. Why to have such a
feature? What is the point? What is the difference