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


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

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

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

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
  • 求推荐一款中小企业使用的进销存软件(零售批发类,要有记录序列号功能)?

    查看案例

  • 有什么网盘资料值得分享?

    查看案例

  • 外贸独立站怎么做SEO?

    查看案例

  • 如何评价青年科学基金项目(A类)将为35岁以下科研人员单设赛道?

    查看案例

  • 055大驱到底强在哪里?

    查看案例

  • 你认为这次伊以冲突,以色列这次干得漂亮吗?

    查看案例

  • 如果你有300万存款,你敢辞职躺平吗?

    查看案例

  • DF-41已经可以打击美国本土,这是否相当于古巴导弹危机常态化?

    查看案例