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


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

更新时间:2025-06-27 20:25:15

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

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
  • 如何看待广西举全区之力支持柳州化解债务?为什么最近地方债又重回公众视野?

    查看案例

  • 防关联浏览器都有哪些?哪些比较好一些?

    查看案例

  • 女生体毛旺盛是什么样的体验?

    查看案例

  • mysql每天有1千万数据 怎么办?分表吗 有什么好的方案。?

    查看案例

  • 为什么各大品牌内存条包装都那么low?

    查看案例

  • 如何评价首个女性友好的编程语言HerCode?

    查看案例

  • Centos为什么突然没人用了?

    查看案例

  • 索尼互动娱乐宣布 PS6 的开发工作已经全面启动,你会如何期待索尼的下一代游戏主机呢?

    查看案例