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


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

更新时间:2025-06-25 14:30: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
  • vue + tsx 的开发体验能追得上 react+tsx么?

    查看案例

  • 吵架后,老公快一个星期不联系,是要离婚的节奏吗?

    查看案例

  • 为什么妈妈岗网络上有些人评价很差?

    查看案例

  • 前端因为像素还原设计稿而离职,这是个别现象吗?

    查看案例

  • 冬天也要穿胸罩吗?

    查看案例

  • 央企的信创,是否有必要把 spring 替换成国产的 solon ?

    查看案例

  • 华为和硅基流动发布CloudMatrix384超节点部署DeepSeek的报告,对行业有何影响?

    查看案例

  • 如何看待现在大多数男人都不谈恋爱了?

    查看案例