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


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

更新时间:2025-06-22 04:35:10

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

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
  • 鱼缸氨氮含量低,但是硝酸盐和亚硝酸盐爆表,已经一个多周了,咋办?

    查看案例

  • 如何看待苹果在 WWDC25 发布的 Foundation 模型框架,它将为开发者和用户带来哪些改变?

    查看案例

  • 脸与身材不符是种怎样的体验?

    查看案例

  • 为什么QQ上的网络状态没有了?

    查看案例

  • 中国外交部及有关使领馆正迅速组织撤离在以、伊的中国公民,目前当地情况如何?

    查看案例

  • 为什么各大 *** 出奇一致地设置了『摇一摇开屏广告』?如何关闭常用 *** 的这些广告?

    查看案例

  • 导师给了1.4W要我给工作室买个主机,是整机还是自己配?

    查看案例

  • 狗头萝莉究竟做错了什么?

    查看案例