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

2025-06-23 00:00: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
相关阅读
如何电脑下载Adobe audition?

如何电脑下载Adobe audition?

在音频界的资深人士应该听说过或用过Cool edit pro...

2025-06-22
如何评价Cursor?

如何评价Cursor?

使用经验: 1、git管理好版本,改了、达到了预期效果就保存...

2025-06-22
中国的歼35A可以吊打十架韩国的KF21吗?

中国的歼35A可以吊打十架韩国的KF21吗?

首先说结论一架歼-35A吊打最少100架KF21,为什么这么...

2025-06-22
女生穿超短裙就是为了给别人看吗?

女生穿超短裙就是为了给别人看吗?

以前上大学时校内医院的门诊上有一个女大夫,30多岁,长的还行...

2025-06-22
北京日报点名批评“苏超”过度娱乐化的动机是什么?

北京日报点名批评“苏超”过度娱乐化的动机是什么?

准确的说,是感受到了威胁。 贵州村超规模小,位置偏远,当地...

2025-06-22