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


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

更新时间:2025-06-18 14:35:14

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

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
  • 如何评价MiniMax开源首个视觉RL统一框架V-Triune,实现推理感知一肩挑,其技术上有何优势?

    查看案例

  • 普通家用电脑可以搭建nas吗?

    查看案例

  • 儿子被大学退学,呆在家里啥也不干,我们该怎么办?

    查看案例

  • 为什么 macOS 并不差,可市场总敌不过 Windows?

    查看案例

  • 有人说x86是条必沉的船,苹果早就跳船了,微软也有弃船的意图,你怎么看?

    查看案例

  • docker有哪些有趣的用途?

    查看案例

  • 如果意外挖出 10 吨黄金,有那些将它们洗白、正常使用的方法?

    查看案例

  • docker有哪些有趣的用途?

    查看案例