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


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

更新时间:2025-06-25 13:30:12

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

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
  • 不限制语言,客户端GUI开发用什么好?

    查看案例

  • 显示器选32还是27,2k还是4k?

    查看案例

  • 海洋中是否存在可以替代主粮潜力的动植物?

    查看案例

  • 在NAS上安装了什么应用,让你的生活体验有了巨大的提升?

    查看案例

  • 40岁的中年人,失业一年了,出路到底在哪里?

    查看案例

  • 谁能劝我不要买NAS?

    查看案例

  • 为什么人到中年,很少有身材苗条的?

    查看案例

  • 如何看待 Rust 写的 PNG 解码器比 C 实现更快?

    查看案例