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

2025-06-23 12:45:13

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

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
相关阅读
node.js可以做***识别分析吗?

node.js可以做***识别分析吗?

可以做,nodejs可以调用 @tensorflow/tfj...

2025-06-27
折叠屏手机有哪些有用或好玩的功能,你过去不理解,现在离不开?

折叠屏手机有哪些有用或好玩的功能,你过去不理解,现在离不开?

我承认,最初对折叠屏的大屏使用场景更多停留在了『外出装 X』...

2025-06-27
如何评价小米 6 月 26 日发布的小米 YU7、MIX Flip2、REDMI K80 至尊版?

如何评价小米 6 月 26 日发布的小米 YU7、MIX Flip2、REDMI K80 至尊版?

老规矩,开局雷总先汇报成绩,小米集团一季度营收1113亿,同...

2025-06-27
韦东奕的牙怎么没了?

韦东奕的牙怎么没了?

我怀疑,很多学霸,其实并不是什么天才 他们其实是病人 由于大...

2025-06-27
为什么程序员的电脑永远没有弹窗广告?

为什么程序员的电脑永远没有弹窗广告?

说明:该篇幅会超级长,包含普通用户和会用PC的人的操作习惯差...

2025-06-27