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


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

更新时间:2025-06-22 23:20:18

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

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
  • 为什么4k电视剧一集也就4g,但却跟4k原盘电影100g看起来差不多清晰?

    查看案例

  • 用K8s的公司有多少人会部署K8s?

    查看案例

  • 当初中俄为什么不摧毁朝鲜的核设施,让朝鲜拥有了自己的核武器?

    查看案例

  • 《流浪地球 3》官宣马丽加入,对于她的表现你有哪些期待?

    查看案例

  • 如何评价最新发布的 vivo X Fold5,作为首款「三防」折叠屏手机,都有哪些亮点值得关注?

    查看案例

  • 皮肤太白是种怎样的体验?

    查看案例

  • 大家如何看待女儿奴?

    查看案例

  • 伊朗为什么会被中俄抛弃?

    查看案例