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


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

更新时间:2025-06-24 08:20: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
  • 如何看待机器之心重测高考数学全卷,Gemini夺冠,豆包DeepSeek并列第二?

    查看案例

  • 养乌龟是什么体会?

    查看案例

  • Gemini 2.5 Flash 和Pro稳定版上线,和之前版本相比,在性能和应用场景上有哪些提升?

    查看案例

  • 如何看待多地推出升级版「禁酒令」?

    查看案例

  • 你看过哪些以为是段子新闻,结果发现居然是真的?

    查看案例

  • 中美会因台海开战吗?

    查看案例

  • 你最满意的10款 PC 软件是什么?

    查看案例

  • 自己拥有一台服务器可以做哪些很酷的事情?

    查看案例