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


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

更新时间:2025-06-27 20:55: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
  • 现在的中国打的过美国吗?

    查看案例

  • 为什么web worker可以在前端开多线程,解决单线程卡死页面的问题,但是没有得到广泛使用?

    查看案例

  • 如何看待日本小学校园餐只有一小块鸡肉?

    查看案例

  • 开发了一个App,上线之后一个用户也没有怎么办?

    查看案例

  • 吴柳芳教体操真的一个月只有3500吗?

    查看案例

  • 有没有GUI框架开发难度小,***消耗又不多,而且又跨平台?

    查看案例

  • 独立开发者都使用了哪些技术栈?

    查看案例

  • 中年夫妻有多少生活和谐的?

    查看案例