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


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

更新时间:2025-06-21 23:30:15

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

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
  • 在深圳找个男朋友难吗?

    查看案例

  • 皮肤太白是种怎样的体验?

    查看案例

  • 轰20的亮相为什么被反复推迟?

    查看案例

  • 你捡过最大的漏是什么?

    查看案例

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

    查看案例

  • 怎么才能有尤雨溪一半强,该怎么学习?

    查看案例

  • 30岁了,你在深圳过着什么样的生活?

    查看案例

  • 如何评价捞女游戏改名,全网“围剿”,以及导演b站账号被封这件事?

    查看案例