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

Views :
Update time : 2025-06-18 19:35:11

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

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-24 18:10:12
为什么大多数人都怕蛇?...
Blog Post With Youtube Video 女朋友是跳拉丁舞的,跳双人舞时会有身体接触,作为男友我感觉有点吃醋怎么办?
2025-06-24 19:30:12
女朋友是跳拉丁舞的,跳双人舞时会有身体接触,作为男友我感觉有点吃醋怎么办?...
Blog Post With Youtube Video 你见过最无用的节俭行为是什么?
2025-06-24 18:10:12
你见过最无用的节俭行为是什么?...
Blog Post With Youtube Video 00后比90后少了4700万,大家对生孩子为什么越来越抗拒?
2025-06-24 19:00:11
00后比90后少了4700万,大家对生孩子为什么越来越抗拒?...

Leave Your Message