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


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

更新时间:2025-06-25 13:30: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
  • Electron是否有作为游戏引擎的潜力?

    查看案例

  • 从技术上看,cloudflare比其他公司牛在哪儿?

    查看案例

  • ant-design-vue 社区为什么不维护了?

    查看案例

  • 如何看待不超过1879元的Mac mini(M4+16/256GB+票),易用性吊打同级其他台式电脑?

    查看案例

  • 有哪些好用的免费内网穿透工具?

    查看案例

  • 为什么韩国的热辣舞团无法征服中国的男性市场??

    查看案例

  • 新买的移动硬盘该格式化为 NTFS 还是 exFAT?

    查看案例

  • 「绝世美女」都有什么特点?

    查看案例