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


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

更新时间:2025-06-19 08:50: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
  • 为什么男生都不喜欢173身高的女生啊?

    查看案例

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

    查看案例

  • 公务员单位为什么不用指纹打卡机并且严格考勤制度?

    查看案例

  • 电蚊香液对身体有害吗?

    查看案例

  • 为什么音乐老师几乎都是女的?

    查看案例

  • 有什么网盘资料值得分享?

    查看案例

  • 如何评价张靓颖刘宇宁《九万字》?

    查看案例

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

    查看案例