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

Views :
Update time : 2025-06-18 16:45:14

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

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 06:40:10
生完孩子身材依旧火辣是一种怎样的体验?...
Blog Post With Youtube Video 如何制造一个高级的阳谋?
2025-06-24 06:45:10
如何制造一个高级的阳谋?...
Blog Post With Youtube Video 组nas一定要TDP低的cpu吗?
2025-06-24 06:30:10
组nas一定要TDP低的cpu吗?...
Blog Post With Youtube Video PHP现在真的已经过时了吗?
2025-06-24 05:05:09
PHP现在真的已经过时了吗?...

Leave Your Message