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


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

更新时间:2025-06-20 22:30:16

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

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
  • 为什么显示器都会介绍面板bit数,而电视只介绍背光bit数?

    查看案例

  • 前端移动端开发***需要那些技术?

    查看案例

  • 鱼缸过滤全天开着太耗电,关掉半天又容易水浑,有什么好办法?

    查看案例

  • 机械硬盘会不会被固态盘彻底取代?

    查看案例

  • 中国现有的雷达技术能发现B2么?

    查看案例

  • 哪张照片让你觉得刘亦菲美得不可方物?

    查看案例

  • 如何看待解清帅直播卖货?

    查看案例

  • Vue性能优于React,那为什么还不用Vue?

    查看案例