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


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

更新时间:2025-06-22 13:10:12

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

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
  • 各位都在用Docker跑些什么呢?

    查看案例

  • 已经有 Web 了,为什么国内还有各种小程序,快应用这种畸形的产物?

    查看案例

  • 网传《碟中谍 8》亏损可能超 14 亿,是真的吗?这背后的原因是什么?

    查看案例

  • 前端是不是快没了?

    查看案例

  • 《士兵突击》中如果高城动用关系,史今能不能留下来?

    查看案例

  • 用PHP写了个小框架,怎么才能得到大佬们的指点?

    查看案例

  • 公司规定所有接口都用 post 请求,这是为什么?

    查看案例

  • 高考不能取消“各省为战”,全国同一标准,择优选拔的原因何在?阻力何在?

    查看案例