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


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

更新时间:2025-06-20 19:00: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
  • 如何看待 Rust 的应用前景?

    查看案例

  • 初次 DIY 电脑时都犯过哪些低级错误?

    查看案例

  • 太空中没有氧气,为什么太阳还在燃烧?

    查看案例

  • 2025年了,京东是不是已经度过了此次风波?

    查看案例

  • 2025 年还能等得到 LCD 屏的旗舰机吗?

    查看案例

  • 为什么一直唱衰的php语言反而日渐活跃?

    查看案例

  • 你捡过最大的漏是什么?

    查看案例

  • 如何评价 Steam 新游《捞女游戏》(已改名《情感反诈模拟器》)?

    查看案例