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


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

更新时间:2025-06-22 21:45: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
  • 有哪些是你用上了mac才知道的事?

    查看案例

  • 据报道称“浏览器内核有上千万行代码”,浏览器内核真的很复杂吗?

    查看案例

  • 老公想要买2万左右的相机,我该同意吗?

    查看案例

  • 有没有什么惊为天人的 Logo 设计?

    查看案例

  • Golang vs Rust vs Dlang 哪个更有前途,哪位大牛这 3 门语言都用过?

    查看案例

  • C#如此设计完善的语言,为什么要搞个多播委托这样失败的设计?

    查看案例

  • 2025年,歼16与美军机50分钟缠斗,为什么知乎上没有任何消息?

    查看案例

  • 空调现在抽真空15分钟真的还有意义吗?

    查看案例