当前位置: 首页 >

正文

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

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

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

2025-06-21 21:20:16浏览:99次
电话:
客服QQ:
邮箱:
22年第一次玩王泪(没有玩旷野之息)惊为天人,孜孜不倦的玩了
20年蛋壳公寓暴雷,所有住户被赶出了租房,腾讯的微众银行要求
一开始的预测是CPU单核9010,多核m2,GPU对比910
别说慈禧,任何一个看过《戊戌变法》内容的现代人都会秒变“守旧
查看所有文章