Go 终于要搞泛型了 (1.18 版本)

2021-10-28 15:51:59 +08:00
 Jooooooooo

groups.google.com/g/golang-dev/c/iuB22_G9Kbo/m/7B1jd1I3BQAJ

"Go 1.18 will include support for generics."

4774 次点击
所在节点    Go 编程语言
26 条回复
SingeeKing
2021-10-28 23:08:18 +08:00
告诉你个秘密,Go 1.17 已经可以通过 flag 开启范型了(只不过不能 export )
24bit
2021-10-28 23:15:49 +08:00
https://go.googlesource.com/proposal/+/refs/heads/master/design/43651-type-parameters.md

```
This is the design for adding generic programming using type parameters to the Go language. This design has been proposed and accepted as a future language change. We currently expect that this change will be available in the Go 1.18 release in early 2022.
```
BeautifulSoap
2021-10-28 23:23:48 +08:00
靠来晚了,被楼上老哥抢先了。偷偷跟你们说个秘密,go 1.17 就支持泛型了。编译的时候加上-gcflags=-G=3 这个 flag 就能编译有范型的代码了
cmdOptionKana
2021-10-28 23:47:03 +08:00
@sagaxu golang 官方应该没有提出过这个原则吧,网友戏言岂可当真。
SorcererXW
2021-10-29 08:13:21 +08:00
@cmdOptionKana

Less is exponentially more -- Rob Pike
defage
2021-10-29 08:44:31 +08:00
@janxin 请看 Java

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/811288

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX