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


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

更新时间:2025-06-23 21:20: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
  • 做好的flask项目怎么部署到服务器,使用公网ip可访问?

    查看案例

  • 如何评价浙江这个省?

    查看案例

  • 蜜雪冰城香港门店被通报「产品大肠菌群超标 70%」,哪些环节可能导致大肠菌群超标?会对身体有哪些危害?

    查看案例

  • 为什么国外网站总喜欢弹出cookie访问权限弹窗,国内网站却没有,这么做有什么意义?

    查看案例

  • 高速铁轨为什么没有伸缩缝,热胀冷缩问题是怎么解决的?

    查看案例

  • 高速铁轨为什么没有伸缩缝,热胀冷缩问题是怎么解决的?

    查看案例

  • 最近在给公司的项目做开发,能否推荐一款方便集成性价比高服务好的IMSDK?

    查看案例

  • 作为一个服务器,node.js 是性能最高的吗?

    查看案例