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


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

更新时间:2025-06-20 18:30:15

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

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
  • 如何看待三峡集团总部搬迁至武汉?

    查看案例

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

    查看案例

  • 如何评价解放军空军中型隐身多用途战斗机歼-35A亮相?

    查看案例

  • 为什么不建议在 Docker 中跑 MySQL?

    查看案例

  • 24-25赛季 NBA 总决赛 G6 步行者 108-91 雷霆,如何评价本场比赛?

    查看案例

  • NAS的盘是否需要一次性买齐?

    查看案例

  • 30岁了,你在深圳过着什么样的生活?

    查看案例

  • 穿瑜伽裤爬山的女生会不会害羞?

    查看案例