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


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

更新时间:2025-06-27 22:55:12

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

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
  • 发达国家放弃全电动车,我国电车一降再降,高举发展新能源汽车大旗,电车会变成中国车企自嗨吗?

    查看案例

  • 给AI植入广告,***还是***蜜?_OpenAI_ChatGPT_用户

    查看案例

  • 手机厂商集体破防:这届新品为何不涨不行?_成本_消费者_存储

    查看案例

  • 求大神解答,为什么大家都不喜欢用docker?

    查看案例

  • 2025微短剧:“暴富”只存在于剧里_用户_红果_***

    查看案例

  • 小米 YU7 发布会,有哪些大说特说的点其实是行业基操?

    查看案例

  • 现在工作中k8s是使用containerd还是docker来管理容器?

    查看案例

  • 追热点丨太阳X级耀斑爆发,明后天可能出现较强地磁活动!网友:这就是我嗜睡的原因?_磁暴_影响

    查看案例