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

Views :
Update time : 2025-06-24 09:25: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要标新立异用中括号?
Related News
Read More >>
Blog Post With Youtube Video 大家有什么被中医震惊征服的经历吗?
2025-06-27 05:15:10
大家有什么被中医震惊征服的经历吗?...
Blog Post With Youtube Video 以前很多人家里都有家庭***,为什么现在几乎看不到了?
2025-06-27 05:00:10
以前很多人家里都有家庭***,为什么现在几乎看不到了?...
Blog Post With Youtube Video 女明星穿瑜伽裤出门是什么体验?
2025-06-27 05:55:10
女明星穿瑜伽裤出门是什么体验?...
Blog Post With Youtube Video 为什么 Go 语言的 Error Handling 被某些人认为是一个败笔?
2025-06-27 06:50:10
为什么 Go 语言的 Error Handling 被某些人认为是一个败笔?...

Leave Your Message