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


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

更新时间:2025-06-26 06:45: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
  • 为什么日本人口密度这么大还能住一户建,中国只能住楼房?

    查看案例

  • 刘亦菲为什么不结婚?

    查看案例

  • CPU 为什么很少会坏?

    查看案例

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

    查看案例

  • 中国现有的雷达技术能发现B2么?

    查看案例

  • 高瓴资本等多家投资机构参与竞购星巴克中国业务,他们看中了什么?竞购成功者可能需要解决哪些问题?

    查看案例

  • 给小孩买什么游戏机?

    查看案例

  • Node.js是谁发明的?

    查看案例