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


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

更新时间:2025-06-26 09:25: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
  • 为什么微软还没有倒闭?

    查看案例

  • 「绝世美女」都有什么特点?

    查看案例

  • 图形用户界面GUI最早能什么时候出现?

    查看案例

  • 如何看待rust编写的zed编辑器?

    查看案例

  • 服务器能否拒绝非浏览器发起的HTTP请求?

    查看案例

  • 如何评价 Arch Linux?

    查看案例

  • 为什么零知识证明(ZKP)领域的开源项目几乎都用Rust实现?

    查看案例

  • 能发一张在暧昧期的聊天记录吗?

    查看案例