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


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

更新时间:2025-06-22 18:25: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
  • 全班 43 人开家长会只来了 7 位爸爸,学校称未来准备策划爸爸家长会,如何看待这一现象?

    查看案例

  • NAS的盘是否需要一次性买齐?

    查看案例

  • 哪一句话让你沉默了很久?

    查看案例

  • 今天面试第五家公司被拒,面试官说我你技术没问题,但35岁要25k,不如招2个应届生,我该如何应对?

    查看案例

  • 好看的***推荐(已完结)?

    查看案例

  • 如果一家网站通过诸如cloudflare等cdn加速服务套了个壳,那还有办法查到该网站的ip地址吗?

    查看案例

  • 怎么才能有尤雨溪一半强,该怎么学习?

    查看案例

  • 古代军队明明有前锋开路,为什么大军还会被埋伏?

    查看案例