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


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

更新时间:2025-06-20 21:40:16

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

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
  • 《三角洲行动》还能活多久?

    查看案例

  • 美国真会下场对伊朗开战吗?

    查看案例

  • 自己拥有一台服务器可以做哪些很酷的事情?

    查看案例

  • SpaceX 星舰 36 号火箭静态点火测试爆炸,爆炸的原因是什么?会对星舰发展产生什么影响?

    查看案例

  • 有哪些BI工具惊艳了你?

    查看案例

  • 如何评价前端框架 Solid?

    查看案例

  • 为什么老特摄电影能一眼看出是模型?

    查看案例

  • MacOS真的比Windows流畅吗?

    查看案例