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

2025-06-22 22:50:12

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

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
相关阅读
华为是真的遥遥领先吗?

华为是真的遥遥领先吗?

华为是世界第一大的光伏逆变器厂商 华为是世界第一大的5G基站...

2025-06-21
Manus会不会开源?

Manus会不会开源?

Manus是否开源已经没有那么重要了。 。 。 。 。 。 ...

2025-06-21
你最近有什么烦心事吗?把这里当树洞,说出来,可以吗?

你最近有什么烦心事吗?把这里当树洞,说出来,可以吗?

还有一个月30岁,骨科大夫。 从今年四五月份,打一场篮球拉...

2025-06-21
学生校服如何隐藏内衣痕迹?

学生校服如何隐藏内衣痕迹?

不应该在乎这些东西,因为你怎么样都有别人攻击你的点,露出内衣...

2025-06-21
坚持使用 PHP 的你,如今有什么感悟?

坚持使用 PHP 的你,如今有什么感悟?

做了十年php开发,做到了技术经理。 2020年开始每入职一...

2025-06-21