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


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

更新时间:2025-06-24 04:25:14

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

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
  • 中医为什么提倡禁一切寒凉之物?

    查看案例

  • LCD党真的只是少部分人吗?

    查看案例

  • 小米 AI 眼镜发布,售价 1999 元起,有哪些功能亮点?你看好其市场前景吗?

    查看案例

  • 男朋友负债 2 万亿人民币,能要吗?

    查看案例

  • 电影《碟中谍》系列中哪一部最好?

    查看案例

  • 民航局紧急通知禁止携无 3C 标识及被召回的充电宝乘境内航班,无 3C 标识充电宝有哪些安全隐患?

    查看案例

  • 为什么老一辈人厌恶游戏?

    查看案例

  • 可以讲讲你们的遗憾吗?

    查看案例