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


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

更新时间:2025-06-18 09:40:13

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

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
  • 公司规定所有接口都用 post 请求,这是为什么?

    查看案例

  • 写代码的时候总是考虑太多怎么办?

    查看案例

  • 如何看待rust编写的zed编辑器?

    查看案例

  • 如何评价前端框架 Solid?

    查看案例

  • 拒绝情绪输出,大家觉得有什么办法可以让国足堂堂正正进入世界杯?

    查看案例

  • 美国搞出个“稳定币”,到底是什么?其它国家是如何看待稳定币的?

    查看案例

  • Rust、Go、Zig、Dart、C3、C++、C,仓颉、moonbit、凹语言哪个语言更有未来?

    查看案例

  • 你的低成本爱好是什么?

    查看案例