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


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

更新时间:2025-06-19 06:40:10

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

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
  • 前端 css 中的 Grid 属性有哪些?

    查看案例

  • 2025年有没有推荐的键盘最好静音效果好点的?

    查看案例

  • 为什么是9月3日阅兵而不是10月1日国庆阅兵?

    查看案例

  • 中国的野球水平也和职业足球一样低吗?

    查看案例

  • 如何看待“计算机民科“的网站51soez已关站维护一周?

    查看案例

  • 男子与妻子发生性关系被告***,此案会成为国内第一起在婚姻存续期间内、感情未破裂、未分居下的***案吗?

    查看案例

  • 你会把交往十年的闺蜜删除吗?

    查看案例

  • 如果你是荔枝使,如何在十天内让杨贵妃吃上新鲜荔枝?

    查看案例