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


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

更新时间:2025-06-22 00:10:16

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

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
  • 如何评价字节跳动开源的 HTTP 框架 Hertz ?

    查看案例

  • 如何看待英伟达新推出的显卡5090dd?

    查看案例

  • 国产数据库有什么坑?

    查看案例

  • 如果一个人长时间不说话,是不是会丧失语言能力?

    查看案例

  • 5 月 28 日 DeepSeek R1 模型完成小版本试升级并开源,具体有哪些提升?使用体验如何?

    查看案例

  • 平面设计真的很难做吗?

    查看案例

  • 相对于 Linux,Windows Server 存在的意义是什么?

    查看案例

  • Rust开发Web后端效率如何?

    查看案例