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

2025-06-21 20:05:16

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

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要标新立异用中括号?
广告位810*200
相关阅读
到底是9800x3d+5070ti还是u7+5080?

到底是9800x3d+5070ti还是u7+5080?

9800X3D 3300 U7 2200 两者相差1000 ...

2025-06-19
如何寻找到相对完整的真正的游戏的源码用来学习?

如何寻找到相对完整的真正的游戏的源码用来学习?

拿破仑1813(Wargamer: Napoleon's 1...

2025-06-19
360 集团周鸿袆努力拼了 4  年,最后反而跌了近 4000 亿,其原因是什么?

360 集团周鸿袆努力拼了 4 年,最后反而跌了近 4000 亿,其原因是什么?

大家都知道360借条吧?一直挂的是360的品牌,在360集团...

2025-06-19
字节大量使用新语言,包括go,rust等,为什么阿里一直都抱着j***a不松手?

字节大量使用新语言,包括go,rust等,为什么阿里一直都抱着j***a不松手?

我在字节的两个小产出,就是在广告投放场景把一个Go服务和一个...

2025-06-19
中国军事力量在亚洲能排第一吗?

中国军事力量在亚洲能排第一吗?

是不是第一不知道,不过中国军队有个称号,叫专打第三,把世界第...

2025-06-19