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


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

更新时间:2025-06-22 17:15: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
  • 中国人群体有什么特点?

    查看案例

  • 住在一个脏乱差的家里十几年是什么感受?

    查看案例

  • 网络小白如何建立一个网站,供别人下载文件(主要是PDF和MP3)?

    查看案例

  • 中国军事力量在亚洲能排第一吗?

    查看案例

  • 印度是真的烂还是咱们在信息茧房里面?

    查看案例

  • 我毕业想成为前端工程师,可是前端技术太多,越学越多,可是我想成为技术强的人,又很无助,怎么办?

    查看案例

  • 用了几年大厂云服务器,现在想换便宜的,有推荐的吗?

    查看案例

  • ddns,仅ipv6访问,***s 高位端口号,需要ICP备案么?会被运营商封锁么?

    查看案例