The draft syntax for type lists is a comma separated list:
type SignedInteger interface {
type int, int8, int16, int32, int64
}
Wouldn't it be more consistent with existing Go syntax regarding types if
it was a semicolon separated list in curly braces?
type SignedInteger interface {
type {int; int8; int16; int32; int64}
}
With automatic semicolon insertion:
type SignedInteger interface {
type {
int
int8
int16
int32
int64
}
}
At least that's how 'struct' and 'interface' separate their items.
If some day, somehow, type lists should emerge from 'interface' as
non-nilable sum types, the natural syntax would be:
type MySum type {
A
B
}
var mySum type{A; B}
Even if this will never happen, this thought experiment suggests that curly
braces and semicolons are the more Go-like syntax choice for type lists.
--
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].
To view this discussion on the web visit
https://groups.google.com/d/msgid/golang-nuts/f1c5ef30-833b-4fd7-b6a6-68cef4f7ec9fn%40googlegroups.com.