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


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

更新时间:2025-06-26 07:45: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
  • 为什么牛吃素可以长那么壮?而人不吃荤就不行?

    查看案例

  • 儿子抑郁四年左右了,他的未来该怎么办?

    查看案例

  • 有哪些是你用上了mac才知道的事?

    查看案例

  • 韩国日本是发达国家,没有主权重要吗?

    查看案例

  • 如何低成本地过有益的生活?

    查看案例

  • 如果你是荔枝使,如何在十天内让杨贵妃吃上新鲜荔枝?

    查看案例

  • 请问群晖的docker还能装些什么?

    查看案例

  • 鱼缸过滤全天开着太耗电,关掉半天又容易水浑,有什么好办法?

    查看案例