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

Views :
Update time : 2025-06-27 22:55: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-22 15:40:12
有性瘾女朋友每天都要很多遍要不要分手?...
Blog Post With Youtube Video 美军 B-2 轰炸机参与袭击伊朗核设施,B-2轰炸机战斗力如何?会摧毁伊朗核设施吗?
2025-06-22 15:15:11
美军 B-2 轰炸机参与袭击伊朗核设施,B-2轰炸机战斗力如何?会摧毁伊朗核设施吗?...
Blog Post With Youtube Video 你们是怎么远程用NAS听歌的?
2025-06-22 16:15:11
你们是怎么远程用NAS听歌的?...
Blog Post With Youtube Video 印度是真的烂还是咱们在信息茧房里面?
2025-06-22 15:35:11
印度是真的烂还是咱们在信息茧房里面?...

Leave Your Message