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


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

更新时间:2025-06-21 14:20:17

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

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
  • 什么才是真正的爱情?

    查看案例

  • 深圳高二中学生「手搓」火箭飞燕一号发射成功,突破 10KM 海拔高度,这属于什么水平?手搓火箭有多难?

    查看案例

  • 13/14代 i7 i9 处理器大规模缩肛为什么没有在老化测试时发现?

    查看案例

  • 被称为「人间尤物」的女主,有多绝?

    查看案例

  • 排版用什么软件比较好啊?

    查看案例

  • 055驱逐舰 是个什么概念?

    查看案例

  • HTTP/3 解决了什么问题,又引入了什么新问题?

    查看案例

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

    查看案例