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


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

更新时间:2025-06-23 21:50: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
  • 功夫游戏《师父》火了之后,为什么没能掀起做功夫题材的游戏的浪潮?

    查看案例

  • creo 的功能有什么特色?

    查看案例

  • 如何看待不超过1879元的Mac mini(M4+16/256GB+票),易用性吊打同级其他台式电脑?

    查看案例

  • Dify工作流,你有哪些好玩的点子?

    查看案例

  • 为什么那么多公司做前后端分离项目后端响应的 HTTP 状态一律 200?

    查看案例

  • 为什么女儿的反应这么强烈?

    查看案例

  • 以色列IDF陆军无比拉胯,但空军的战绩却非常拿的出手,同一个国家的军队战斗力为什么两极分化如此严重?

    查看案例

  • SATA固态好用吗?为什么大家都喜欢m.2呢?

    查看案例