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


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

更新时间:2025-06-22 21:45:17

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

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
  • 女性的困境到底是什么呢?

    查看案例

  • 鱼缸能不能做到一直不换水还很清澈?

    查看案例

  • vue转react是什么感受?

    查看案例

  • YU7 之后的下一辆小米汽车可能是啥?小米会把所有车型做一遍吗?

    查看案例

  • 为什么台式 PC 还处在组装(DIY)阶段?

    查看案例

  • 为什么日本经济下降,大学排名跌至谷底,还有那么多人挤破脑袋去日本留学?

    查看案例

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

    查看案例

  • 你见过最脑残的设计是什么?

    查看案例