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


大部分语言都用尖括号<>表示泛型,为什么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
  • 鸿蒙折叠屏笔记本为什么敢卖26999?

    查看案例

  • 鸿蒙电脑会在国内逐渐取代windows电脑吗?

    查看案例

  • 055驱逐舰的战力被低估还是被高估?

    查看案例

  • 为什么会有人相信骗子的话去缅甸找高薪工作呢?

    查看案例

  • 字节大量使用新语言,包括go,rust等,为什么阿里一直都抱着j***a不松手?

    查看案例

  • 曼德拉是南非的罪人吗?

    查看案例

  • 如何评价网易国产动作冒险单机新作《归唐》首支预告片?

    查看案例

  • 为什么微软会允许中国有那么多盗版?

    查看案例