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


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

更新时间:2025-06-24 09:25: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
  • docker 容器启动后如何添加端口映射?

    查看案例

  • 自己拥有一台服务器可以做哪些很酷的事情?

    查看案例

  • 什么是稳定币?有人说它是「一场饮鸩止渴的游戏」,你怎么看?

    查看案例

  • 既然C#等开源语言,为啥***le还要弄个基本上一模一样的Swift?

    查看案例

  • 苹果从 2026 年发布的 macOS 27 起不再兼容任何 Intel Macs,这背后原因有哪些?

    查看案例

  • 被称为「人间尤物」的女主,有多绝?

    查看案例

  • 为什么有的人喜欢带着 MacBook 去咖啡店或者书店上网,而不是 ThinkPad 之类的?

    查看案例

  • 为何中文互联网相对英文互联网的内容质量较低?

    查看案例