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


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

更新时间:2025-06-22 01:20: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
  • 坚持使用 PHP 的你,如今有什么感悟?

    查看案例

  • 我是新手想养鱼,预算不超过200。有什么好的建议或者禁忌吗。?

    查看案例

  • 如何看待2025年多地推出升级版「禁酒令」?

    查看案例

  • 如何高效将 HTML 内容转换成卡片形式?

    查看案例

  • 你和你老婆是怎么认识的?

    查看案例

  • 我毕业想成为前端工程师,可是前端技术太多,越学越多,可是我想成为技术强的人,又很无助,怎么办?

    查看案例

  • 如何看待盲人UP主蒙眼炒鸡蛋在成都各大医院都买不到胰岛素,最后进抢救室?

    查看案例

  • HTTP/3 解决了什么问题,又引入了什么新问题?

    查看案例