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


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

更新时间:2025-06-24 01: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
  • JetBrains 放弃 AppCode 是否是一个错误决定?

    查看案例

  • 为什么小爱音箱只能播放qq音乐免费音乐?

    查看案例

  • 如何评价b站陈睿和徐逸疑似减股跑路?

    查看案例

  • 林述巍跟隋坡这两位谁的水平高?

    查看案例

  • 30马赫的导弹,近防炮能挡住吗?

    查看案例

  • 有一个乌克兰的朋友问我,中国人凭什么能享受和平,我该怎么说?

    查看案例

  • 老公加班过多,是逃避家庭责任吗?

    查看案例

  • 为什么程序员独爱用Mac进行编程?

    查看案例