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


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

更新时间:2025-06-23 02:10:14

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

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
  • 为什么Next.js和Nuxt.js发布时间只隔了几小时?

    查看案例

  • 汤姆·克鲁斯在国外算几线?

    查看案例

  • 如何评价黄霄云这个人?

    查看案例

  • 有什么是你去河南才明白的事?

    查看案例

  • 开战斗机从上海到北京要多久,那是一种什么样的体验?

    查看案例

  • 如何看待 2026QS 世界大学排名?

    查看案例

  • 你为什么在日常生活中不敢穿的太漂亮?

    查看案例

  • 为什么泰州发展不起来?

    查看案例