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


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

更新时间:2025-06-21 20:05: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
  • 如何评价***伊内斯·特洛奇亚的身材?

    查看案例

  • 深圳房价能跌到什么位置?

    查看案例

  • 女性为什么不普遍跟男性那样只留个几毫米或2-3厘米短发,女性不觉得长发麻烦吗?

    查看案例

  • 如何看待b站出现有关小米的大量反向标题,号称“薅千亿补贴”的现象?

    查看案例

  • 写代码的时候总是考虑太多怎么办?

    查看案例

  • 你见过最有远见的人是什么样的?

    查看案例

  • 为什么程序员独爱用Mac进行编程?

    查看案例

  • 开发了一个App,上线之后一个用户也没有怎么办?

    查看案例