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


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

更新时间:2025-06-22 15:30:16

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

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
  • 你捡过最大的漏是什么?

    查看案例

  • ***x512具体在哪些方面应用?

    查看案例

  • 警犬知道自己是警犬么?

    查看案例

  • 为什么中国农村房子那么丑?

    查看案例

  • 苹果为什么要给每代MacOS起个名字,真以为人们记得住分得清吗?

    查看案例

  • 一名女子在杭州万象城遭挟持被捅 20 多刀,隆胸***体救了一命,这反映出哪些公安系统的问题?

    查看案例

  • 有哪一个瞬间让你对女朋友彻底失望?

    查看案例

  • PHP现在真的已经过时了吗?

    查看案例