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


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

更新时间:2025-06-18 20:25:12

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

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
  • 最讨厌和哪种人打羽毛球?

    查看案例

  • 鸿蒙电脑会在国内逐渐取代windows电脑吗?

    查看案例

  • 尘螨过敏的最好解决办法是什么?

    查看案例

  • 得了颈椎病有多痛苦?

    查看案例

  • 为什么越来越多的国内男孩,要娶国外女孩?

    查看案例

  • 伊朗称向以发射使用射程达 2000 公里的「泥石」地对地弹道导弹,其威力有多大?

    查看案例

  • Rust的设计缺陷是什么?

    查看案例

  • 凤凰传奇曾毅公开佩戴含有不雅元素的手表,这涉嫌违法吗?如何从法律角度解读?

    查看案例