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


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

更新时间:2025-06-22 17:15: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
  • 做个web服务器,gin框架和go-zero怎么选?

    查看案例

  • 胸大的女孩会自卑 吗?

    查看案例

  • 巴基斯坦军方在社交媒体上宣布,中国已下达特别命令,加快向巴基斯坦交付歼35***飞机,这事靠谱吗?

    查看案例

  • 医院的信息科工作是怎么样的体验?

    查看案例

  • 我女儿三岁两个月背下整首木兰辞,请问这说明她特别聪明吗?

    查看案例

  • 我的世界怎么租一个四个人的服务器?

    查看案例

  • 为什么现在的年轻人活的都很通透?

    查看案例

  • 新婚那天晚上你们是怎样度过的?

    查看案例