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


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

更新时间:2025-06-25 12:05: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
  • 前端,后端,全栈哪个好找工作?

    查看案例

  • 现在读写速度最快的硬盘,能在30年前的计算机上当做内存使用吗?

    查看案例

  • 为什么同样是输球,常州和国足的风评却差那么多呢?

    查看案例

  • 不用CDN就没事,用阿里云CDN就被攻击刷流量,阿里云表示证明不了就要用户买单,如何看到这种行为?

    查看案例

  • 洲际导弹能打到任何地方,为什么还需要轰炸机?

    查看案例

  • 你最满意的10款 PC 软件是什么?

    查看案例

  • 我的设计作品很烂嘛?

    查看案例

  • 养乌龟生态缸到底可行吗?

    查看案例