当前位置:当前位置: 首页 >

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

发布日期:2025-06-18 09:40:13

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

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要标新立异用中括号?

上一篇 : 大疆硬刚:被美制裁近10年,反诉FCC胜算大吗?_美国_企业_Textron
下一篇 : Anthropic控告中国AI蒸馏,马斯克和整个互联网都笑了_训练_Claude_模型

主页    |     盛乐镇    |     正余镇    |     高砂镇    |     郑路镇    |     禾云镇    |     如意乡    |