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


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

更新时间:2025-06-24 02:10:15

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

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
  • 网传《碟中谍 8》亏损可能超 14 亿,是真的吗?这背后的原因是什么?

    查看案例

  • 请问为什么32寸4k的显示器推荐极少呢?

    查看案例

  • IT行业夫妻双双被裁,想去新西兰闯一闯可以吗?

    查看案例

  • 27寸显示器是否有必要到4K?

    查看案例

  • 封建王朝为什么总是陷入财政崩溃的循环?

    查看案例

  • 穿了瑜伽裤真的舒服吗?

    查看案例

  • 豆包推出 AI 编程,在「编辑模式」下可以直接前端改图和文字,体验如何?对行业会带来怎样的影响?

    查看案例

  • 女生到底应不应该穿***的衣服?

    查看案例