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


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

更新时间:2025-06-18 17:15:13

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

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
  • 中国什么时候可以实现全民双休?

    查看案例

  • 为什么《绝区零》打磨了那么多细节的同时,却有一个灾难性的UI设计?

    查看案例

  • 为什么现在很多人推崇国外原版教材?

    查看案例

  • 你卡过最厉害的bug是什么?

    查看案例

  • PlayStation 5 发布五周年,销量不错但粉丝们普遍表示失望,这背后的原因是什么?

    查看案例

  • 真的没有人觉得2k是一个很尴尬的分辨率吗?

    查看案例

  • 豆包推出 AI 编程,在「编辑模式」下可以直接前端改图和文字,体验如何?对行业会带来怎样的影响?

    查看案例

  • 央企的信创,是否有必要把 spring 替换成国产的 solon ?

    查看案例