Rust 和 Go 的并发模型有什么不同,为什说 Rust 的并发模型更好 ?(1.0已没有内建模型?
网传《碟中谍 8》亏损可能超 14 亿,是真的吗?这背后的原因是什么?
为什么中国现在全球军事实力第一,但包括中国人在内很多人不认可?
为什么和婆婆在一起生活很压抑?
***咖被曝员工月薪 2300 元只休 1 天,这样的薪资和工作条件是否合理?
iOS 26 的新设计被吐槽丑,苹果在设计更新时考虑了哪些因素?你对这一设计都有哪些评价?

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

发布日期:2025-06-22 12:40:16 浏览次数:0

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

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