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


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

更新时间:2025-06-26 08: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
  • 理论上flutter性能应该非常高才对,为什么好些flutter应用性能一般?

    查看案例

  • 哪张照片让你觉得刘亦菲美得不可方物?

    查看案例

  • 为什么 Linux 软件安装包会有依赖关系,而 Windows 软件安装包不需要?

    查看案例

  • 跨平台GUI框架到底应该自绘还是原生控件绑定?

    查看案例

  • 2025年现在开发php项目选择lar***el框架好还是thinkphp框架好?

    查看案例

  • 为什么台式 PC 还处在组装(DIY)阶段?

    查看案例

  • 导师给了1.4W要我给工作室买个主机,是整机还是自己配?

    查看案例

  • 2025年6月,到底买油车还是电车?

    查看案例