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


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

更新时间:2025-06-26 07:45:10

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

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
  • 有个漂亮女朋友是种怎样的体验?

    查看案例

  • 外贸独立站怎么做SEO?

    查看案例

  • 鸿蒙电脑会在国内逐渐取代windows电脑吗?

    查看案例

  • 能分享一下你写过的rust项目吗?

    查看案例

  • 如何评价巴黎世家官宣杨超越为品牌挚友?

    查看案例

  • 凤凰传奇曾毅公开佩戴含有不雅元素的手表,这涉嫌违法吗?如何从法律角度解读?

    查看案例

  • cloudflare的1.1.1.1和warp有什么区别?

    查看案例

  • 顶级军事家的水平有多恐怖呢?

    查看案例