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


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

更新时间:2025-06-27 20:25:15

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

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
  • 为什么很多香港明星没有子女?

    查看案例

  • 老公一个月给我1万3,但是我们没有钱旅行,到底是我不会管钱,还是老公给得太少?

    查看案例

  • 什么是Android逆向?如何学习安卓逆向?

    查看案例

  • 为什么Mac连个正儿八经的CAD都装不了还敢打着生产力的旗号?

    查看案例

  • 冬天也要穿胸罩吗?

    查看案例

  • 谷歌发布新模型 AlphaGenome,一次可读取 100 万个 DNA 碱基,对生物学研究有何影响?

    查看案例

  • 一辈子戴眼镜好,还是做近视手术好?

    查看案例

  • 如果苹果真的下架了微信的话,会发生什么?

    查看案例