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


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

更新时间:2025-06-23 09:05:13

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

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
  • 美国搞出个“稳定币”,到底是什么?其它国家是如何看待稳定币的?

    查看案例

  • NAS噪音太大,大家都吧NAS放置到哪了?

    查看案例

  • 长期使用的大佬来说说,MacOS 真的比 Windows 稳定吗?

    查看案例

  • 如何评价前端组件库shadcn/ui?

    查看案例

  • 360 集团周鸿袆努力拼了 4 年,最后反而跌了近 4000 亿,其原因是什么?

    查看案例

  • 如何判断鱼缸中的硝化系统是否已经成功建立?

    查看案例

  • 电脑有64G的物理内存(DDR5 5200),完全够用了,可以关闭系统的虚拟内存吗?

    查看案例

  • 网络小白如何建立一个网站,供别人下载文件(主要是PDF和MP3)?

    查看案例