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


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

更新时间:2025-06-23 00:00:13

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

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
  • 韦东奕(北大韦神)要是去写游戏引擎代码,能不能把虚幻引擎按在地上摩擦?数学好真能‘降维打击吗?

    查看案例

  • 《武林外传》中有哪些值得学习的职场关系?

    查看案例

  • 你用n8n/dify搭建了哪些实用的Agent工作流?

    查看案例

  • 为什么音乐老师几乎都是女的?

    查看案例

  • 如何看待 稚晖君第五轮融资 估值将达70亿?

    查看案例

  • 如何看待 稚晖君第五轮融资 估值将达70亿?

    查看案例

  • 为什么大家不再提星链了(包括外网)?

    查看案例

  • 鸿蒙折叠屏笔记本为什么敢卖26999?

    查看案例