`generics` looks like a space ,
like c++ namespace/classSpace use `::` `.` `->`
and `::` is not used in golang.
```
type A::(x,y,z) struct{ }
func f::(x,y,z)()(){}
interface B::(x,y,z)()(){}
[]S::(x,y,z){}
```
`FOO::(x,y,z)` just like a `string` for naming .
and the args x,y,z are defined without types.
在2020年7月16日星期四 UTC+8 下午12:42:47<Kaveh Shahbazian> 写道:
> Proposals that employ the type keyword, look more Go-ish. Go is already
> doing many things differently than other PLs in C-ish family - the if
> without parentheses and no semicolon are two of things that hit most when
> switching frequently between Go and another PL.
>
> func SomeContext() {
> var aSlice [](typeㅤ T)
> var aMap map[typeㅤ T](type ㅤU)
> var aChannel <-chan (typeㅤ T)
>
> aSlice = make([]int, 0)
> aMap = make(map[int]int)
> aChannel = make(chan int)
>
> otherStuff(aSlice, aMap, aChannel)
> }
>
> func Action(x typeㅤ T, y, delta type ㅤU) (xres type ㅤT, yres type ㅤU) {
> return
> }
>
> type Data struct {
> typeㅤ T
> type ㅤU
>
> Input T
> Output U
> }
>
> type Processor interface {
> Process(typeㅤ T) (Data {type ㅤT = T, typeㅤ U = string}, error)
> }
>
> type Actual struct {
> type ㅤR
> }
>
> func (Actual) Process(input typeㅤ T = R) (Data{typeㅤ T = T, type ㅤU =
> string}, error) {
> return Data { input, "" }
> }
>
>
--
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/7ee85439-fa05-454f-9957-4791144b42b3n%40googlegroups.com.