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


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

更新时间:2025-06-25 23:25:16

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

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
  • 国外(GoDaddy)注册的域名如何在国内备案?

    查看案例

  • 目前美军还有哪些领域是明显领先于解放军的?

    查看案例

  • MiniMax 推出全球首个开源大规模混合架构的推理模型 MiniMax-M1,其有何技术优势?

    查看案例

  • 奥迪暂停全面电动化***,不再设定停售燃油车时间表,此前沃尔沃、奔驰也调整全面电动化***,如何解读?

    查看案例

  • 中国军队有多强,在世界能排第几?

    查看案例

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

    查看案例

  • 马斯克宣布星舰将配备 42 台发动机,如何评价这一设计?

    查看案例

  • 为什么有的房东喜欢把房间租给女租户?

    查看案例