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


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

更新时间:2025-06-25 14:55:13

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

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
  • 如何看待同样被美国制裁,小米反诉成功,明明是小米不跪,小米却不断被黑?

    查看案例

  • 如何看待“京东外卖停止补贴后,日单量跌至两万单”这件事?

    查看案例

  • 维护一个大型开源项目是怎样的体验?

    查看案例

  • 最近在给公司的项目做开发,能否推荐一款方便集成性价比高服务好的IMSDK?

    查看案例

  • 喝完酒第二天生不如死怎么办?

    查看案例

  • 国家统计局表示,青年人失业率连续 3 个月下降,现在找工作实际情况如何?

    查看案例

  • PC端非常好用的软件有哪些?

    查看案例

  • 伊朗和以色列为什么此时爆发冲突?背后有哪些深层原因?

    查看案例