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


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

更新时间:2025-06-19 22:45:12

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

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
  • 不限制语言,客户端GUI开发用什么好?

    查看案例

  • 深圳房价能跌到什么位置?

    查看案例

  • 如何看待机器之心重测高考数学全卷,Gemini夺冠,豆包DeepSeek并列第二?

    查看案例

  • 只是突然很好奇,已经造出了三艘航母,为何不能按照这样的模板,批量建造航母呢?

    查看案例

  • 为什么UC曾经是国内主流浏览器之一,但现在却逐渐销声匿迹了?

    查看案例

  • 参加知乎「第十一届新知青年大会」是种什么样的体验?

    查看案例

  • 真的有这种又苗条身材又爆炸的么?

    查看案例

  • 24-25赛季 NBA 总决赛 G6 步行者 108-91 雷霆,如何评价本场比赛?

    查看案例