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


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

更新时间:2025-06-28 02:55: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
  • Rust1.86才正式稳定trait的upcast,为什么在rust中这个特性实现如此复杂?

    查看案例

  • 为什么 mac mini 的 m4 版本价格这么低呢?

    查看案例

  • 罗马仕宣布召回超 49 万台充电宝,极端场景下可能有燃烧风险,有多危险?为何有安全隐患的产品能够上市?

    查看案例

  • 全世界都在等中美开战吗?

    查看案例

  • 在武汉,你们的找对象标准是怎样的?

    查看案例

  • 有什么好看的追妻火葬场的文吗?

    查看案例

  • 如果你是《一帘幽梦》里的绿萍,你会不会最后原谅紫菱?

    查看案例

  • 求大神解答,为什么大家都不喜欢用docker?

    查看案例