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


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

更新时间:2025-06-22 01:20:15

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

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
  • 为什么只听过果粉、米粉、花粉没听说过 Windows 粉?

    查看案例

  • 为什么用 electron 开发的桌面应用那么多?

    查看案例

  • 网恋发现对方太好看了怎么办?

    查看案例

  • 2025年了,京东是不是已经度过了此次风波?

    查看案例

  • 央企的信创,是否有必要把 spring 替换成国产的 solon ?

    查看案例

  • 为什么日本人室内光脚啊?他们屋子里有这么干净吗?

    查看案例

  • 哈尔滨高温大学生楼道睡觉,学生称体感温度 37、38℃,东北学校该不该装空调?未来东北高温天会更多吗?

    查看案例

  • 马斯克的星舰是不是打脸了中国航天?

    查看案例