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


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

更新时间:2025-06-22 00:50: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
  • 谷歌云服务宕机导致 OpenAI、Shopify 等服务中断,此次宕机的具体技术原因是什么?

    查看案例

  • ***拍大尺度片子时摄影师不会看光吗?

    查看案例

  • 做好的flask项目怎么部署到服务器,使用公网ip可访问?

    查看案例

  • 让男朋友坐在马桶上上厕所很过分吗?

    查看案例

  • 评价一下Proxmox VE与ESXi的优劣?

    查看案例

  • 为什么有的女生喜欢穿紧身牛仔裤?

    查看案例

  • 网传厦门某国企研发部门要求每日考察后端 400 行,前端 1000 行代码量,如属实,这个考核合理吗?

    查看案例

  • 世界上存在动漫少女般完美的「身体」吗?

    查看案例