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


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

更新时间:2025-06-23 15:30:19

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

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
  • 外贸独立站怎么做SEO?

    查看案例

  • 我很好奇現在内地同胞們對香港的總體印象如何?

    查看案例

  • 中国民间中小工厂能快速造出武器吗?

    查看案例

  • 国内很多男性在非洲和当地女人恋爱是真的吗?

    查看案例

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

    查看案例

  • 如何评价鸿蒙NEXT的卓易通?

    查看案例

  • 外贸独立站怎么做SEO?

    查看案例

  • 13/14代 i7 i9 处理器大规模缩肛为什么没有在老化测试时发现?

    查看案例