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


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

更新时间:2025-06-21 20:45:16

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

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-zero的svc全局变量和Kratos按需利用wire进行依赖注入哪个在实际生产合作中更合适?

    查看案例

  • 国外的女生为什么屁股都大?

    查看案例

  • 有一个***约你出去,你会去吗?

    查看案例

  • 27寸显示器有必要上4K吗?

    查看案例

  • 输入法,从学习难度,重码率来看选择五笔还是仓颉比较好,不是非常追求速度,日常打字需求,优缺点各是什么?

    查看案例

  • 为什么感觉wps的用户越来越多,office没人用了?

    查看案例

  • 为什么windows的arm版没有被广泛使用?

    查看案例

  • 语雀后端从Node迁移到J***a说明了什么?

    查看案例