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

Views :
Update time : 2025-06-23 02:10:14

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

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 鸿蒙PC操作系统是不是就是手机操作系统?
2025-06-26 13:40:18
鸿蒙PC操作系统是不是就是手机操作系统?...
Blog Post With Youtube Video 现在写 J***aScript 的是不是已经没人在用 class 这个关键字了?
2025-06-26 13:05:18
现在写 J***aScript 的是不是已经没人在用 class 这个关键字了?...
Blog Post With Youtube Video 有什么软件官方已经停更了或者公司已经倒闭了,但是你还在用并且觉得很好用的?
2025-06-26 12:05:18
有什么软件官方已经停更了或者公司已经倒闭了,但是你还在用并且觉得很好用的?...
Blog Post With Youtube Video 为什么国内的车型总是阉割CarPlay?
2025-06-26 11:55:18
为什么国内的车型总是阉割CarPlay?...

Leave Your Message