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


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

更新时间:2025-06-18 19:35: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
  • 如何评价mq白这个人?

    查看案例

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

    查看案例

  • 为什么负荷那么大的腰部力量训练的人不会受伤,长期无载荷久坐的人会出现腰肌劳损?

    查看案例

  • CPU 为什么很少会坏?

    查看案例

  • opencv如何识别低对比度露珠?

    查看案例

  • 你见过最无用的节俭行为是什么?

    查看案例

  • PostgreSQL 与 MySQL 相比,优势何在?

    查看案例

  • 为什么Next.js和Nuxt.js发布时间只隔了几小时?

    查看案例