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


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

更新时间:2025-06-22 20:00:11

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

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
  • threejs是如何才能渲染出这种效果的?

    查看案例

  • 买到烂尾楼到底该有多绝望?

    查看案例

  • 生完孩子身材依旧火辣是一种怎样的体验?

    查看案例

  • 什么APp听音乐免费?

    查看案例

  • postgres集群的选择?

    查看案例

  • 土豆都能做出什么美食?

    查看案例

  • 为什么说微软 Win11,有苹果 macOS 的感觉?

    查看案例

  • 伊朗称袭击以色列「网络首都」,该地聚集英特尔、微软等多家高科技企业,伊朗为何选择这里?会造成哪些影响?

    查看案例