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


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

更新时间:2025-06-21 19:30:20

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

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
  • MacBook的诱惑在哪里?

    查看案例

  • 如果一个人长时间不说话,是不是会丧失语言能力?

    查看案例

  • 网传《碟中谍 8》亏损可能超 14 亿,是真的吗?这背后的原因是什么?

    查看案例

  • 为什么国内的uni***一直没人讨论呢?

    查看案例

  • 前端因为像素还原设计稿而离职,这是个别现象吗?

    查看案例

  • 怎么用deepseek 编写程序代码开发软件?

    查看案例

  • 特朗普称美国完成对伊朗三处核设施的打击,具体情况如何?伊朗会如何反击?

    查看案例

  • 大三做的海报,离就业差多远?

    查看案例