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


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

更新时间:2025-06-20 09:45: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
  • 想知道字节用什么分布式配置中心呢,作为golang大厂,应该不是沿用JAVA的配置中心吧?

    查看案例

  • 周杰伦为什么不告粥饼伦黑伦侵犯他的名誉权?

    查看案例

  • 怎么隔离dify和RAGflow ?

    查看案例

  • 为什么 Bun 选择了 Zig 以及 JSCore?

    查看案例

  • 妈妈去世后,外婆家的亲戚集体不来,我还要跟他们交往吗?

    查看案例

  • 为什么越来越多的私企与民企成立党支部?

    查看案例

  • 一套正版adobe全家桶多少钱?

    查看案例

  • NAS噪音太大,大家都吧NAS放置到哪了?

    查看案例