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

Views :
Update time : 2025-06-28 02:55: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-24 14:35:13
你是在什么时候认识到自己好看的?...
Blog Post With Youtube Video 自己拥有一台服务器可以做哪些很酷的事情?
2025-06-24 14:40:14
自己拥有一台服务器可以做哪些很酷的事情?...
Blog Post With Youtube Video Flutter 为什么没有一款好用的UI框架?
2025-06-24 15:35:14
Flutter 为什么没有一款好用的UI框架?...
Blog Post With Youtube Video 在办公室用机械键盘是什么心里?
2025-06-24 14:30:13
在办公室用机械键盘是什么心里?...

Leave Your Message