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

Views :
Update time : 2025-06-23 00:00:13

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

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 年还能等得到 LCD 屏的旗舰机吗?
2025-06-27 03:00:11
2025 年还能等得到 LCD 屏的旗舰机吗?...
Blog Post With Youtube Video 在TN-C系统中,零对地电压为8V,此时再增加地针数量会不会降低电压数值?
2025-06-27 01:35:10
在TN-C系统中,零对地电压为8V,此时再增加地针数量会不会降低电压数值?...
Blog Post With Youtube Video 日本AV对中国人的毒害有多大?
2025-06-27 01:40:11
日本AV对中国人的毒害有多大?...
Blog Post With Youtube Video 程序员看剧的时候,如果看到有敲代码页面,会暂停看代码吗?
2025-06-27 02:50:10
程序员看剧的时候,如果看到有敲代码页面,会暂停看代码吗?...

Leave Your Message