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


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

更新时间:2025-06-22 00:50:11

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

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
  • 为什么中国主机带宽比美国贵5倍(原来错误的10000倍),比如阿里云?

    查看案例

  • 国内大厂现在用rust的多吗?

    查看案例

  • 为什么中国防空反导系统才7年就从山寨到全面原创且超越了俄罗斯?

    查看案例

  • 如何看待现在的前端?

    查看案例

  • 只考虑隐身和载荷航程,中国轰六K能投GBU57巨型钻地弹,炸福尔多***吗?

    查看案例

  • 养乌龟生态缸到底可行吗?

    查看案例

  • 核聚变是一条死胡同吗?

    查看案例

  • 小米YU7从7月提前至6月底发布,是什么原因导致提前发布?

    查看案例