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


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

更新时间:2025-06-22 23:20:18

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

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
  • 乡下的土鸡真的值100块钱吗?

    查看案例

  • postgresql也很强大,为何在中国大陆,mysql成为主流,postgresql屈居二线呢?

    查看案例

  • 为什么Dreamwe***er,FrontPage会被淘汰?

    查看案例

  • SwiftUI 是不是一个败笔?

    查看案例

  • 有一张巨强的显卡是什么体验?

    查看案例

  • 做个web服务器,gin框架和go-zero怎么选?

    查看案例

  • Mac OS 系统是否内存越大越好?

    查看案例

  • 超级喜欢穿短裙正常吗?

    查看案例