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


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

更新时间:2025-06-23 11:25:15

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

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
  • 为什么有的房东喜欢把房间租给女租户?

    查看案例

  • 和男朋友说我姐想见他,想让他请吃饭,他觉得不应该他请客,这个人行不行?

    查看案例

  • 中国的 App 怎么这么恶心啊,还是说安卓恶心?

    查看案例

  • ant-design-vue 社区为什么不维护了?

    查看案例

  • Centos为什么突然没人用了?

    查看案例

  • 为什么我感觉广西未来会撤自治区改省?

    查看案例

  • 2025年,Gitea 和 GitLab 应当如何选择?

    查看案例

  • 程序员都有自己的服务器吗?

    查看案例