I just read the "official" proposal for Go2 generics and contracts.
The current proposal makes the function syntax more complex, and the syntax
for the contract is a bit magic.
What about something like:
type stringer template
contract (x stringer) {
var s string = x.String()
}
func Stringify(s []stringer) (ret []string) {
for _, v := range s {
ret = append(ret, v.String())
}
return ret
}
instead of
contract stringer(x T) {
var s string = x.String()
}
func Stringify(type T stringer)(s []T) (ret []string) {
for _, v := range s {
ret = append(ret, v.String())
}
return ret
}
Thanks
Manlio
--
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 [email protected].
For more options, visit https://groups.google.com/d/optout.