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


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

更新时间:2025-06-20 15:55: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
  • 哪个ai写代码最强?

    查看案例

  • 全世界都在等中美开战吗?

    查看案例

  • 程序员需要用到内置kvm功能的显示器吗?或者是外置的kvm切换器吗?

    查看案例

  • 12306 网站的根目录下为什么连 robots.txt 文件(反爬虫协议)都没有?

    查看案例

  • 中国的歼35A可以吊打十架韩国的KF21吗?

    查看案例

  • 高校里那些「非升即走」后「走」了的青年教师都怎么样了?

    查看案例

  • 如何评价高圆圆的身材算是美女类型的吗?

    查看案例

  • 发烧友都说磁带音质秒杀CD黑胶和hires,啥原因?

    查看案例