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


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

更新时间:2025-06-22 21:10: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
  • 修仙文明可能以怎样的方式碾压星际文明?

    查看案例

  • Node.js 性能为什么这么差?

    查看案例

  • 如何评价微软的远程桌面?

    查看案例

  • 当初中俄为什么不摧毁朝鲜的核设施,让朝鲜拥有了自己的核武器?

    查看案例

  • 为什么16-28岁女性对labubu欲罢不能?

    查看案例

  • 为什么是9月3日阅兵而不是10月1日国庆阅兵?

    查看案例

  • 如何评价前端组件库shadcn/ui?

    查看案例

  • 什么时候你意识到自己不年轻了呢?

    查看案例