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

2025-06-22 16:05:17

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

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
相关阅读
有一张巨强的显卡是什么体验?

有一张巨强的显卡是什么体验?

说个反的,1660显卡玩黑猴,画面马赛克但游戏流畅,也就没在...

2025-06-22
用K8s的公司有多少人会部署K8s?

用K8s的公司有多少人会部署K8s?

只要愿意问,LLM能把幼儿园的小朋友教会怎么部署k8s,但事...

2025-06-22
92年的大龄剩女,还有必要结婚吗?

92年的大龄剩女,还有必要结婚吗?

佛山92年,离异没有孩子,接受吗? 年龄:92年 身高体重:...

2025-06-22
以前大力推广的沼气池,怎么现在越来越少了?

以前大力推广的沼气池,怎么现在越来越少了?

2003年~2010年,鼓励农村修建沼气池,说这东西不仅能解...

2025-06-22
世界上哪款战斗机最好看?

世界上哪款战斗机最好看?

NO.10 F/A18经典虫(个人认为比超虫好看) ...

2025-06-22