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


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

更新时间:2025-06-24 02:10:10

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

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
  • 有什么你去了韩国才知道的事?

    查看案例

  • 如何评价最新发布的 vivo X Fold5,作为首款「三防」折叠屏手机,都有哪些亮点值得关注?

    查看案例

  • 家里想搞个服务器,有什么好的建议方案吗?

    查看案例

  • 有用 NAS 被联通以安全为由要求停止使用的吗?

    查看案例

  • 有没有宝塔平替的服务器管理面板,现在宝塔越来越贵了,也太臃肿了?

    查看案例

  • 小米 AI 眼镜发布,售价 1999 元起,有哪些功能亮点?你看好其市场前景吗?

    查看案例

  • 为什么中国很多孩子都不会去考虑家长的感受?

    查看案例

  • 编程语言 MoonBit 发布 Beta 版,正式进入企业场景应用,会带来哪些影响?

    查看案例