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

Views :
Update time : 2025-06-26 07:15: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 老公一个月给我1万3,但是我们没有钱旅行,到底是我不会管钱,还是老公给得太少?
2025-06-29 04:40:09
老公一个月给我1万3,但是我们没有钱旅行,到底是我不会管钱,还是老公给得太少?...
Blog Post With Youtube Video switch模拟器是不是历史上唯一在主机当红时就几乎完美模拟器?
2025-06-29 04:30:09
switch模拟器是不是历史上唯一在主机当红时就几乎完美模拟器?...
Blog Post With Youtube Video 「灰电平衡」这种说法是怎么被流传出来的?
2025-06-29 04:10:09
「灰电平衡」这种说法是怎么被流传出来的?...
Blog Post With Youtube Video 现在干什么能挣钱?
2025-06-29 05:30:10
现在干什么能挣钱?...

Leave Your Message