你现在的位置是:当前位置: 首页 >


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

更新时间:2025-06-27 23:35:16

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

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要标新立异用中括号?

案例推荐

case recommendation
  • 美国很多地方废弃,为啥很多人宁可在街上流浪,也没有人去开荒种地呢?

    查看案例

  • 云南作为之前的西南大省为什么发展不起来?

    查看案例

  • 企业级 SSD 与消费级 SSD 的区别是什么?

    查看案例

  • 现在二手房是不是卖不出去了?

    查看案例

  • HTML+CSS有哪些常用的居中方法?

    查看案例

  • Excel 不用 VBA,你使用过哪些绝妙的公式?

    查看案例

  • 周鸿祎为什么说他这辈子最鄙视李彦宏?

    查看案例

  • 为什么LibreOffice的Windows版在国内火不起来?

    查看案例