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


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

更新时间:2025-06-24 09:25: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
  • Golang与Rust哪个语言会是今后的主流?

    查看案例

  • 腰陆陆续续疼了一年多了,这个是腰突吗?

    查看案例

  • REDMI K80 至尊版手机搭载 7410mAh 电池,此款手机有哪些亮点?

    查看案例

  • 如何评价苹果 3 月 5 日发布的 MacBook Air M4,相比前代有哪些提升?

    查看案例

  • 小米的研发经费真的很少吗?

    查看案例

  • 如何看待日本小学校园餐只有一小块鸡肉?

    查看案例

  • Apple 为什么不封杀 Flutter 呢?

    查看案例

  • 使用 Go 语言开发大型 MMORPG 游戏服务器怎么样?

    查看案例