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

Views :
Update time : 2025-06-19 04:50:09

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

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-20 11:45:13
如果在野外发现了一只大熊猫,很脏,领回家给他洗个澡,再养几天,犯法吗?...
Blog Post With Youtube Video mac新手,想请问一下老手们你们的软件都是付费买的吗?
2025-06-20 11:40:14
mac新手,想请问一下老手们你们的软件都是付费买的吗?...
Blog Post With Youtube Video 女性为什么不普遍跟男性那样只留个几毫米或2-3厘米短发,女性不觉得长发麻烦吗?
2025-06-20 11:05:14
女性为什么不普遍跟男性那样只留个几毫米或2-3厘米短发,女性不觉得长发麻烦吗?...
Blog Post With Youtube Video 有个亲妹妹是什么感觉?
2025-06-20 10:45:13
有个亲妹妹是什么感觉?...

Leave Your Message