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


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

更新时间:2025-06-22 12:00: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
  • 腰椎间盘突出导致腿麻脚麻怎么办?

    查看案例

  • 脸与身材不符是种怎样的体验?

    查看案例

  • 新手想要打好篮球,主要练运球还是投篮?

    查看案例

  • 干猎头有前途吗?

    查看案例

  • 毕设答辩,老师说node不可能写后台怎么办?

    查看案例

  • 韦东奕的牙怎么没了?

    查看案例

  • 如何评价库洛前员工6个月试用期,第5个月29天被裁,还被追偿高额违约金,2年5次的仲裁/诉讼维权经历?

    查看案例

  • 手术时把大脑拿出来还能接回去吗?

    查看案例