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


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

更新时间:2025-06-22 20:00:11

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

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
  • 足球的地面身体对抗和肌肉体重关系大,还是和技巧关系更大?

    查看案例

  • 为什么小米造车可以叫小米,而华为不可以用华为品牌造车?

    查看案例

  • 想做一个专门养黑壳虾的鱼缸,有什么建议?

    查看案例

  • 如果一个人有足够的钱让他一直***,那毒品对他的身体还有害吗?

    查看案例

  • 慈禧为什么要反对戊戌变法?

    查看案例

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

    查看案例

  • 程序员如何用好 Cursor 工具?

    查看案例

  • 和女生旅游开一间房有什么注意事项?

    查看案例