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


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

更新时间:2025-06-24 02:10: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
  • 一个坚持练搏击二十年的70岁老人,能打过30岁同样体重的普通人吗?

    查看案例

  • 为什么有的女生喜欢穿紧身牛仔裤?

    查看案例

  • 平面设计主KV做成这样,在你的城市薪资一般多少?

    查看案例

  • Electron 和当下其他的桌面开发方法相比如何?

    查看案例

  • KMS激活到底可不可信,是不是盗版的激活方式?

    查看案例

  • 为什么日本人口密度这么大还能住一户建,中国只能住楼房?

    查看案例

  • 为什么游戏总是缺少 dll 文件?

    查看案例

  • 为什么长得漂亮却没什么用?

    查看案例