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

Views :
Update time : 2025-06-19 06:40: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 为什么好多人不承认大众审美就是喜欢白皮?
2025-06-25 13:40:13
为什么好多人不承认大众审美就是喜欢白皮?...
Blog Post With Youtube Video 室友因为身体原因要用冰箱,但是电费却由我们平摊,合理嘛?
2025-06-25 13:35:13
室友因为身体原因要用冰箱,但是电费却由我们平摊,合理嘛?...
Blog Post With Youtube Video 腰肌劳损用什么办法可以治疗好?
2025-06-25 13:05:12
腰肌劳损用什么办法可以治疗好?...
Blog Post With Youtube Video 公司就一个后端一个前端,有必要搞微服务吗?
2025-06-25 12:55:13
公司就一个后端一个前端,有必要搞微服务吗?...

Leave Your Message