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


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

更新时间:2025-06-23 12:15:18

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

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
  • 女明星穿瑜伽裤出门是什么体验?

    查看案例

  • 有一个***约你出去,你会去吗?

    查看案例

  • 鹦鹉有什么让你觉得神奇的地方?

    查看案例

  • 老公加班过多,是逃避家庭责任吗?

    查看案例

  • 粤S在广东是怎么样的存在?粤牌有鄙视链吗?

    查看案例

  • 为什么 WeGame 在国内竞争不过 Steam ?

    查看案例

  • 搞了NAS之后去哪里下载4K,8K的电影?

    查看案例

  • 河北旅游被低估有多严重?

    查看案例