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


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

更新时间:2025-06-22 00:10: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
  • 北京日报点名批评“苏超”过度娱乐化,它是否管的太宽了?为什么无良媒体不会被查封取缔?

    查看案例

  • 怎么劝家里人不去养鱼?

    查看案例

  • 男医生在给年轻靓丽的女性检查时会是什么心态?

    查看案例

  • 为何像JetBrains公司做IDE就可以养活自己,而国内做大型对公软件都很难养活公司?

    查看案例

  • 剪映网页版要下线了,有没有字节的同学来说下是为啥啊?

    查看案例

  • 如何看待三峡集团总部搬迁至武汉?

    查看案例

  • count(*) count(1)哪个更快?

    查看案例

  • 高校里那些「非升即走」后「走」了的青年教师都怎么样了?

    查看案例