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

Views :
Update time : 2025-06-24 02:10:10

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

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 为什么 Windows 系统 Program Files 这个经常用来装软件的目录,名称中有个空格?
2025-06-25 09:25:13
为什么 Windows 系统 Program Files 这个经常用来装软件的目录,名称中有个空格?...
Blog Post With Youtube Video 学生校服如何隐藏内衣痕迹?
2025-06-25 09:45:13
学生校服如何隐藏内衣痕迹?...
Blog Post With Youtube Video 新手平面设计师(方向美工)怎么有目的提升设计能力?
2025-06-25 08:50:13
新手平面设计师(方向美工)怎么有目的提升设计能力?...
Blog Post With Youtube Video 室友因为身体原因要用冰箱,但是电费却由我们平摊,合理嘛?
2025-06-25 09:55:13
室友因为身体原因要用冰箱,但是电费却由我们平摊,合理嘛?...

Leave Your Message