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


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

更新时间:2025-06-18 22:40: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
  • go的channel在实际项目中会怎么使用?

    查看案例

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

    查看案例

  • 为什么不能做出1T的内存条?

    查看案例

  • 为什么美军B2实战以后4v认为一部分网友又没信心了?

    查看案例

  • 成为体育女主播,光「好看」就够了吗?

    查看案例

  • 如何看待北大国发院教授卢锋称「4月青年失业率中国已远超美欧」?

    查看案例

  • 前端是不是快没了?

    查看案例

  • 如何看待美团创始人王兴清空微博?

    查看案例