2025年六月现在硬盘咋还涨价了呢?
Electron 做游戏客户端的潜力有多大?
孩子在「手表圈」里「混圈、相亲、打赏积分」,为何孩子们的通讯工具会变得这么「乱」?家长该怎么引导?
MacOS真的比Windows流畅吗?
为什么都认为无GC语言一定会比有GC语言要快?
谁是对Mac有成见然后用完Mac后真香的?

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

发布日期:2025-06-19 06:40:10 浏览次数:0

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

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