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

2025-06-21 17:45: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
相关阅读
为什么一部分 Go 布道师的博客不更新了?

为什么一部分 Go 布道师的博客不更新了?

哈哈,首先我不是布道师,算是 go 语言的爱好者吧。 😄 自...

2025-06-19
想知道德普怎么看上艾梅柏·希尔德的?

想知道德普怎么看上艾梅柏·希尔德的?

Talulah的人设,漂亮,身材好,家里不缺钱,演员,马斯克...

2025-06-19
***拍大尺度片子时摄影师不会看光吗?

***拍大尺度片子时摄影师不会看光吗?

我现在从事服装行业(内衣)。 这么说把,现在的***,想接...

2025-06-19
女生微胖到底是种什么体验?

女生微胖到底是种什么体验?

真的体验很不好 身高169,体重122-124 由于胖的比较...

2025-06-19
CPU 为什么很少会坏?

CPU 为什么很少会坏?

看,这是芯片颗粒 这个芯片和基板,是通过锡膏粘连起来 百...

2025-06-19