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


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

更新时间:2025-06-22 13:10: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
  • 有一个***约你出去,你会去吗?

    查看案例

  • 再见,人类程序员!OpenAI自曝:一行代码都不写了,100%用Codex_编程_Plan_Claude

    查看案例

  • 突然大爆发,今年首次出现X级大耀斑,网友:这就是我嗜睡的原因?_磁暴_太阳_影响

    查看案例

  • 你们学校的校花都是怎么样的?

    查看案例

  • 1215亿,狠人刘强东又要IPO_工业_物流_中国

    查看案例

  • 300万一张票,90后美女主持送黄景瑜“上天”_穿越_商业_飞船

    查看案例

  • “京东们”,抢着干“脏活累活”_家政_服务_市场

    查看案例

  • 2026春晚,大模型的分水岭_字节_红包_用户

    查看案例