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

Views :
Update time : 2025-06-21 19:30:20

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

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-28 22:05:16
广西有什么比较有特色、方便带走的特产?...
Blog Post With Youtube Video 2025 江西高考本科线历史类 486 分,物理类 429 分较去年降 19 分,怎样看待江西分数线?
2025-06-28 21:05:15
2025 江西高考本科线历史类 486 分,物理类 429 分较去年降 19 分,怎样看待江西分数线?...
Blog Post With Youtube Video 钓鱼怎么绑鱼竿线呢?
2025-06-28 21:25:15
钓鱼怎么绑鱼竿线呢?...
Blog Post With Youtube Video 华为曾承诺“三年不卡顿”,如今三年之期已到,华为手机能做到不卡吗?
2025-06-28 21:55:16
华为曾承诺“三年不卡顿”,如今三年之期已到,华为手机能做到不卡吗?...

Leave Your Message