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


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

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

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

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
  • 谁敢公开一下自己房贷月供,占你收入的多少?对你生活影响大吗?

    查看案例

  • 坚持使用 PHP 的你,如今有什么感悟?

    查看案例

  • 《明朝那些事儿》的作者当年明月疯了,疯了就可以摆脱烦恼了吗?

    查看案例

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

    查看案例

  • 北京日报点名批评“苏超”过度娱乐化,它是否管的太宽了?为什么无良媒体不会被查封取缔?

    查看案例

  • 为什么山姆这么受欢迎?

    查看案例

  • 你见过最无用的节俭行为是什么?

    查看案例

  • 把一个1g的***通过***请求上传到服务器中,如何保证性能?

    查看案例