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


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

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

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

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
  • 哪些令你惊艳的AI大语言模型提示词(prompt)?

    查看案例

  • 想往鱼缸里种点水草,但是家里鱼缸大了买水草泥或者底砂太贵了,有没有生活中可以替代的物品或其他建议?

    查看案例

  • react 跟 vue 哪个更牛逼?

    查看案例

  • 两个问题:女足工资为什么比男足低?如果中国女足和中国男足打一场谁会赢?

    查看案例

  • Electron 做游戏客户端的潜力有多大?

    查看案例

  • 当电脑盲认为自己不是电脑盲时是一种怎样的体验?

    查看案例

  • 为什么hdmi2.1带宽优于dp1.4,还是会推荐dp?

    查看案例

  • 如何看待 Mac mini M4 支持可更换 SSD?

    查看案例