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

2025-06-18 14:35:14

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

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要标新立异用中括号?
广告位810*200
相关阅读
求pr安装包及安装方法?

求pr安装包及安装方法?

现在pr安装包其实非常好找了,不像以前,某度搜索下载下来的,...

2025-06-29
有哪些是你用上了mac才知道的事?

有哪些是你用上了mac才知道的事?

1、macOS支持的软件比想象的要多得多; 2、macOS支...

2025-06-29
都说乱世买黄金,现在算是乱世吗?

都说乱世买黄金,现在算是乱世吗?

算,但不要完全押注黄金。 哪怕是再迟钝的人也应该发现,一个...

2025-06-29
Centos为什么突然没人用了?

Centos为什么突然没人用了?

红帽终于明白到,被白嫖还要自己帮人维护好像太傻了,于是将ce...

2025-06-29
如何评价Electron?

如何评价Electron?

一眨眼就到2025年了,新年快乐! 去年年底(其实就是昨天)...

2025-06-29