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


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

更新时间:2025-06-23 12:15:18

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

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
  • 买到烂尾楼到底该有多绝望?

    查看案例

  • 能够自己一个人创业的全栈web码农fullstack developer要会哪些技术?

    查看案例

  • 为什么情侣在一起旅行后容易分手?

    查看案例

  • 老板说我设计了一周的海报还是不行,我到底该怎么学啊?

    查看案例

  • 社保断缴的后果有些什么?

    查看案例

  • 为什么 lua 在游戏开发中应用普遍?

    查看案例

  • 你在出租房屋发现过什么前租客留下的“宝藏”?

    查看案例

  • 平面设计师要被时代淘汰了吗?

    查看案例