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


大部分语言都用尖括号<>表示泛型,为什么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
  • 如何看待伊朗最高领袖哈梅内伊 6 月 18 日发布“必须强力打击以色列,永不妥协”的声明?

    查看案例

  • 海贼王为什么现在被全网黑?

    查看案例

  • 杨幂论文一年间 AI 率从 0 飙至 91%,为什么会这样?AI 查重到底有没有统一标准?

    查看案例

  • 用了几年大厂云服务器,现在想换便宜的,有推荐的吗?

    查看案例

  • 如何评价高圆圆的身材算是美女类型的吗?

    查看案例

  • 应该如何看待群晖在DSM 7.2.2-72803更新中去掉了Video Station?

    查看案例

  • 脸与身材不符是种怎样的体验?

    查看案例

  • 34岁,女性,不想过夫妻生活,怎么跟老公沟通效果更好?

    查看案例