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


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

更新时间:2025-06-23 02:10:14

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

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
  • 字节大量使用新语言,包括go,rust等,为什么阿里一直都抱着j***a不松手?

    查看案例

  • 为什么软件公司很少用python开发web?

    查看案例

  • Vue性能优于React,那为什么还不用Vue?

    查看案例

  • 吴柳芳的真实水平如何?

    查看案例

  • 程序员的时间管理真的是写代码1小时,调试8小时吗?

    查看案例

  • 为什么女儿的反应这么强烈?

    查看案例

  • Linux 下有没有类似 Everything 的搜索工具?

    查看案例

  • 如何看待 Rust 写的 PNG 解码器比 C 实现更快?

    查看案例