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


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

更新时间:2025-06-20 18:30:15

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

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
  • 鱼缸过滤全天开着太耗电,关掉半天又容易水浑,有什么好办法?

    查看案例

  • 从零写一个3D物理引擎难度多大?

    查看案例

  • 女生真正的完美身材是什么样子?

    查看案例

  • H264和H265谁画质好,求回谢谢!?

    查看案例

  • Rust1.86才正式稳定trait的upcast,为什么在rust中这个特性实现如此复杂?

    查看案例

  • 如何电脑下载Adobe audition?

    查看案例

  • 广西可以摆烂吗?

    查看案例

  • AntV X6 如何在节点中间添加新节点?

    查看案例