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


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

更新时间:2025-06-20 19:00:16

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

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
  • 伊朗警告以色列居民尽快撤离,称将展开真正惩罚性打击,伊朗还有哪些底牌?以伊冲突会演变为中东全面战争吗?

    查看案例

  • 我的世界怎么租一个四个人的服务器?

    查看案例

  • 谁在半夜看过鱼缸里的鱼,它们都在干什么?

    查看案例

  • 为什么越来越多的 SSD 不带片外缓存了?

    查看案例

  • 龙芯在.NET上帮微软做CPU指令集适配,为什么到国内.NET开发者这里成了维护龙芯.NET版本?

    查看案例

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

    查看案例

  • Chrome 浏览器设计的神细节有哪些?

    查看案例

  • 公务员单位为什么不用指纹打卡机并且严格考勤制度?

    查看案例