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

Views :
Update time : 2025-06-22 02:05:10

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

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 年 5 月份居民消费价格同比下降 0.1%,如何看待这一数据?
2025-06-18 22:10:12
2025 年 5 月份居民消费价格同比下降 0.1%,如何看待这一数据?...
Blog Post With Youtube Video 怎么自学成为计算机大佬?
2025-06-18 23:10:11
怎么自学成为计算机大佬?...
Blog Post With Youtube Video 为什么各大 *** 出奇一致地设置了『摇一摇开屏广告』?如何关闭常用 *** 的这些广告?
2025-06-18 22:50:12
为什么各大 *** 出奇一致地设置了『摇一摇开屏广告』?如何关闭常用 *** 的这些广告?...
Blog Post With Youtube Video 为什么小米造车可以叫小米,而华为不可以用华为品牌造车?
2025-06-18 22:45:12
为什么小米造车可以叫小米,而华为不可以用华为品牌造车?...

Leave Your Message