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


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

更新时间:2025-06-23 08: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
  • 有没有什么冷门的高颜值女演员?

    查看案例

  • Golang是不是代替了PHP以前的生态位啊?

    查看案例

  • 《诛仙》中有哪些捧腹大笑的剧情?

    查看案例

  • 为什么苹果的定制硬盘颗粒是银色封装,而无论是nvme ssd,笔记本板载还是手机硬盘都是黑色封装?

    查看案例

  • py爬虫的话,selenium是不是能完全取代requests?

    查看案例

  • 前端因为像素还原设计稿而离职,这是个别现象吗?

    查看案例

  • 女生真正的完美身材是什么样子?

    查看案例

  • 女生真正的完美身材是什么样子?

    查看案例