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


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

更新时间:2025-06-22 16:40:11

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

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
  • 厦门房价2025年会报复性上涨吗?

    查看案例

  • 什么是 5G 固定无线接入(FWA)?

    查看案例

  • DIY的NAS易用性如何?

    查看案例

  • 哪个瞬间让你觉得编程只是一门技术?

    查看案例

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

    查看案例

  • 为什么明明35岁以上的员工更稳定,招聘时不要,被裁的也是他们?

    查看案例

  • 是什么原因导致HDR无法推行?

    查看案例

  • 男朋友因为打游戏骗我去睡觉被我识破,然后我提了分手,他同意了,问问男孩子们他怎么想的?

    查看案例