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


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

更新时间:2025-06-21 22:30:11

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

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
  • 可不可以发一张你觉得最有感觉的照片?

    查看案例

  • 通义千问推出多模态统一理解与生成模型 Qwen VLo,图像生成效果如何?有哪些信息值得关注?

    查看案例

  • 有一张巨强的显卡是什么体验?

    查看案例

  • 究竟怎么学习IOS 开发啊?

    查看案例

  • 为什么小岛秀夫在游戏《死亡搁浅》系列开发中要使用游骑兵的Decima引擎,为啥不用虚幻5呢?

    查看案例

  • 多益网络输了餐费官司,准备近几年搬离广州,你怎么看?

    查看案例

  • 为什么很多人在1panel推出之后,还坚持用宝塔面板?

    查看案例

  • 为什么Rust的包管理器Cargo这么好用?

    查看案例