Groups
Groups
Sign in
Groups
Groups
golang-nuts
Conversations
About
Send feedback
Help
[generics] type lists in interfaces
130 views
Skip to first unread message
武新飞
unread,
Nov 12, 2020, 8:15:16 AM
11/12/20
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to golang-nuts, gri
Here is my suggestion to replace "Type lists in interfaces"
```
type Float interface {
type float32, float64
}
```
Can be
```
type Float = float32 | float64
type Ordered = int | int32 | ... Float | string
```
Ian Lance Taylor
unread,
Nov 12, 2020, 9:10:05 AM
11/12/20
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to 武新飞, golang-nuts, gri
Thanks for the note.
In the current design draft the section
https://go.googlesource.com/proposal/+/refs/heads/master/design/go2draft-type-parameters.md#constraint-type-inference
describes a case where we need both a type list and a method. I don't
see an obvious way to implement that with your suggested syntax.
Ian
Reply all
Reply to author
Forward
0 new messages