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


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

更新时间:2025-06-23 12:45:13

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

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
  • 马上领证了,发现男朋友离不了游戏,让他少打游戏他会非常生气,正常吗?

    查看案例

  • ssd固态硬盘sata的好还是m.2好呢?

    查看案例

  • 宁波东方理工大学学费每人每学年 9.6 万,为什么会这么贵?

    查看案例

  • 请问有没有什么工具能够生成局域网的网络拓扑结构图?

    查看案例

  • 做客孩子临走时带走几只玩具,我的孩子抗拒并一直哭,要怎么开导?

    查看案例

  • 开车的人和不开车的人思维有什么区别?

    查看案例

  • postgresql也很强大,为何在中国大陆,mysql成为主流,postgresql屈居二线呢?

    查看案例

  • 为什么现在很多人推崇国外原版教材?

    查看案例