groups.google.com/g/golang-dev/c/iuB22_G9Kbo/m/7B1jd1I3BQAJ
"Go 1.18 will include support for generics."
groups.google.com/g/golang-dev/c/iuB22_G9Kbo/m/7B1jd1I3BQAJ
"Go 1.18 will include support for generics."
|
iyearOct 28, 2021
1
|
|
kiripengOct 28, 2021
2
是啊,不过确实火星了
|
|
3
@iyear 不一样吧, 看那个 thread 还在讨论要不要加. 这里说是确定要加了.
|
|
iyearOct 28, 2021
4
@Jooooooooo #3 没细看😂
|
|
shyrockOct 28, 2021
5
没泛型有啥干不了的吗?
|
|
6
这里面提到一点蛮有意思的, 说因为大家都没用过 go 的泛型, 所以官方文档也没法给出特别好的最佳实践.
we can't provide anything as prescriptive about style and best practices. We simply don't know them yet. |
|
kidljOct 28, 2021
8
范型意味着多了一种抽象方式,写大型代码更简单了(抽象的角度),阅读大型代码更困难了(理解抽象)。
|
|
defageOct 28, 2021
9
希望不要弄个假泛型或者半吊子泛。
|
|
CodeCodeStudyOct 28, 2021
13
Go 语言之父:不要在 Go 1.18 标准库中使用泛型
https://www.oschina.net/news/164554/do-not-change-the-libraries-in-1-18 |
|
14
@darknoll 这个提法一般特指 java 的泛型擦除且类型系统表达力很弱
因为同样是擦除的 typescript 和 Haskell 好像没人说它们是假泛型🐶 |
|
15
@CodeCodeStudy 旧新闻了, 我发的这个是新的. 今天出的.
|
|
wingooOct 28, 2021
16
1.18 很早就计划上泛型的, 这个讨论只是说 1.18 的版本不会把 go 的内部库改成泛型版本, 等大家都在使用了, 有了实践之后再修改
|
|
INCerryOct 28, 2021
17
要泛型?那大家来用 C#吧
|
|
18
@janxin 通俗来说,**编译时**进行类型展开的做法是真泛型,**运行时**把类型退化到 top type 叫做假泛型。
|
|
19
岂不违背大道至简原则?
|
|
SingeeKingOct 28, 2021
21
告诉你个秘密,Go 1.17 已经可以通过 flag 开启范型了(只不过不能 export )
|
|
24bitOct 28, 2021
22
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. ``` |
|
BeautifulSoapOct 28, 2021
23
靠来晚了,被楼上老哥抢先了。偷偷跟你们说个秘密,go 1.17 就支持泛型了。编译的时候加上-gcflags=-G=3 这个 flag 就能编译有范型的代码了
|
|
QingXuJiaZhiOct 28, 2021
24
@sagaxu golang 官方应该没有提出过这个原则吧,网友戏言岂可当真。
|
|
SorcererXWOct 29, 2021
25
|