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

Views :
Update time : 2025-06-18 20:25:12

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

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要标新立异用中括号?
Related News
Read More >>
Blog Post With Youtube Video 你都见过什么样的电脑盲?
2025-06-22 18:10:11
你都见过什么样的电脑盲?...
Blog Post With Youtube Video 如何看待苹果公司撤下“说服父母给你买一台 Mac”的广告***,上线仅一天?
2025-06-22 17:05:12
如何看待苹果公司撤下“说服父母给你买一台 Mac”的广告***,上线仅一天?...
Blog Post With Youtube Video 为什么在日本是实体店干掉电商,在中国却是电商干掉实体?
2025-06-22 16:40:11
为什么在日本是实体店干掉电商,在中国却是电商干掉实体?...
Blog Post With Youtube Video Unity收费***后,为何大家选择了Godot而不是Cocos?
2025-06-22 16:45:11
Unity收费***后,为何大家选择了Godot而不是Cocos?...

Leave Your Message