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


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

更新时间:2025-06-21 13:15:17

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

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
  • 如何评价首个女性友好的编程语言HerCode?

    查看案例

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

    查看案例

  • 为什么说天下法术尽出江西?

    查看案例

  • 我国的军工能力可以实现一天5000枚火箭弹连着炸三个月吗?

    查看案例

  • 为什么网上对 2.0T 发动机偏见这么大?

    查看案例

  • 长期使用的大佬来说说,MacOS 真的比 Windows 稳定吗?

    查看案例

  • 不管黑客用了多少跳板,最终是不是可以通过网络运营商找出真实 IP?

    查看案例

  • 为什么有些老顾客吃着吃着就不再来照顾生意了?

    查看案例