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


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

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

    查看案例

  • 中国的歼35A可以吊打十架韩国的KF21吗?

    查看案例

  • 为什么越来越多的 SSD 不带片外缓存了?

    查看案例

  • 公立医生帮联系民营救护车,800 公里收费 2.8 万元,收费合理吗?救护车收费标准是什么?

    查看案例

  • 为什么现在房贷利率这么低3.1%了,还有人提前还贷?

    查看案例

  • 小米澎湃OS保留了多少安卓代码?

    查看案例

  • 怎么看待三十而已里说的养鱼让人玩物丧志,养鱼是魔鬼,是黑洞,养鱼毁三代鱼缸毁一生的话?

    查看案例

  • 苹果连了校园网,为什么会出现这个标志?

    查看案例