大部分语言都用尖括号<>表示泛型,为什么golang要标新立异用中括号?

2025-06-21 11:15:11

最新的设计文档里面对这一块做了一个解释。

Why not use the syntax F like C++ and J***a? When parsing code within a function, such as v := F, at the point of seeing the < it's ambiguous whether we are seeing a type instantiation or an expression using the < operator. This is very difficult to resolve without type information. For example, consider a statement like a, b = w < x, y > (z) Withou…。

大部分语言都用尖括号<>表示泛型,为什么golang要标新立异用中括号?
广告位810*200
相关阅读
小腿能粗到什么地步?

小腿能粗到什么地步?

我的小腿,真的非常粗,而且近来可能是运动的缘故,好像还加粗了...

2025-06-26
韦东奕(北大韦神)要是去写游戏引擎代码,能不能把虚幻引擎按在地上摩擦?数学好真能‘降维打击吗?

韦东奕(北大韦神)要是去写游戏引擎代码,能不能把虚幻引擎按在地上摩擦?数学好真能‘降维打击吗?

3D FPS游戏之父约翰·卡马克,跟UE引擎之父蒂姆·斯维尼...

2025-06-26
Unity收费***后,为何大家选择了Godot而不是Cocos?

Unity收费***后,为何大家选择了Godot而不是Cocos?

“有些错误,不是因为你做错了,而是工具从根上就烂了。 ” 作...

2025-06-26
有什么是虚拟机代替不了物理机的?

有什么是虚拟机代替不了物理机的?

看到这个题目,忍不住想吐槽一下 2年前受虚拟化潮流影响,将家...

2025-06-26
ant-design-vue 社区为什么不维护了?

ant-design-vue 社区为什么不维护了?

不会吧…我不太清楚什么情况,只是我在 ant-design-...

2025-06-26