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


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

更新时间:2025-06-27 21:25:17

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

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/3 解决了什么问题,又引入了什么新问题?

    查看案例

  • 如何评价B站峰哥亡命天涯直播中说面包就是比馒头好吃,中国古代不吃面包是因为贫穷,没有足够的柴火?

    查看案例

  • 太空中没有氧气,为什么太阳还在燃烧?

    查看案例

  • 能分享一下你写过的rust项目吗?

    查看案例

  • 27寸显示器是否有必要到4K?

    查看案例

  • 腰肌劳损是如何管理的?恢复之后如何避免复发?

    查看案例

  • MiniMax Week第三天推出通用 Agent,体验如何?对行业会带来哪些影响?

    查看案例

  • 人能为了钱做到什么地步?

    查看案例