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


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

更新时间:2025-06-19 09:25:15

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

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 人才的需求会集中在哪几个方向?

    查看案例

  • 作为一个腰细腿粗的女生什么感觉?

    查看案例

  • 如何看待 2025 浙江高考杭州二中高分段被镇海宁海学军等校「碾压」?

    查看案例

  • 欧盟正考虑降低一系列美国进口商品的关税,欧美最终走到一起,在偶然中是否有其必然性?

    查看案例

  • 原码、反码、补码跟编程语言有关吗?

    查看案例

  • 面试的时候,销售经理让你把一瓶矿泉水卖 300 元,你会怎么应对?

    查看案例

  • 为何犹太人能掌控美国,却拿中国没办法?

    查看案例