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


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

更新时间:2025-06-22 16:05:17

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

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
  • 广西柳江上游出现锑浓度异常,市民称需从消防栓接水或买水,锑可能带来哪些危害?当地需如何妥善解决?

    查看案例

  • 中国与敌国发生战争,哪些国家会帮中国?

    查看案例

  • 为何中文互联网相对英文互联网的内容质量较低?

    查看案例

  • 尼康的镜头里哪款拍摄人像好呢?

    查看案例

  • ICU 的可怕之处在哪?

    查看案例

  • react 跟 vue 哪个更牛逼?

    查看案例

  • 如何看待M4单核性能吊打9950x?

    查看案例

  • 把贵州省撤销,设立一个超大型国家自然公园,是不是一个好的提法?

    查看案例