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


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

更新时间:2025-06-22 18:25: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
  • 为什么黄毛骗走的都是乖乖女?

    查看案例

  • 有一个***约你出去,你会去吗?

    查看案例

  • 有一个乌克兰的朋友问我,中国人凭什么能享受和平,我该怎么说?

    查看案例

  • 如何看待多地开展查摆年轻干部玩心重、混日子、说话随意、口大气粗等问题的行动?

    查看案例

  • 哪吒汽车正式被申请破产,因薪酬问题员工已两月没去上班,被申请破产意味着什么?员工权益还能得到保障吗?

    查看案例

  • 为什么新疆的旅游吸引度远超西藏?

    查看案例

  • 写业务的话,go是不是垃圾?

    查看案例

  • 为什么山姆这么受欢迎?

    查看案例