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


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

更新时间:2025-06-22 22:15: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
  • 鱼缸能不能做到一直不换水还很清澈?

    查看案例

  • 如何看待机器之心重测高考数学全卷,Gemini夺冠,豆包DeepSeek并列第二?

    查看案例

  • Office 中为何还要保留 Access 数据库?

    查看案例

  • 我是新手想养鱼,预算不超过200。有什么好的建议或者禁忌吗。?

    查看案例

  • 如何评价腾讯元宝桌面端使用 Rust 的 Tauri 框架?

    查看案例

  • DF-41已经可以打击美国本土,这是否相当于古巴导弹危机常态化?

    查看案例

  • 以色列为什么要打伊朗?

    查看案例

  • 如何评价《灵笼 2》第六集?

    查看案例