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


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

更新时间:2025-06-21 16:05:12

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

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
  • 有那种裁员裁到大动脉的事儿吗?

    查看案例

  • 如何看待某个日本小学校园餐只有一小块鸡肉?

    查看案例

  • SwiftUI 是不是一个败笔?

    查看案例

  • 有哪位大佬了解FBX文件格式?

    查看案例

  • 只考虑隐身和载荷航程,中国轰六K能投GBU57巨型钻地弹,炸福尔多***吗?

    查看案例

  • 据说go和c#的开发者都说自己比较节省内存,你们认为呢?

    查看案例

  • 以色列为什么突然敢打伊朗了?不怕被报复?

    查看案例

  • 为什么女游泳运动员看起来大部分都是平胸?

    查看案例