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


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

更新时间:2025-06-22 14:45:16

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

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
  • 24岁得了腰突是不是人生就完了?

    查看案例

  • 有什么好的录屏软件吗?要免费且好用的,可以录电脑播放的***?

    查看案例

  • 有没有什么路由器让你用过之后彻底惊艳了?

    查看案例

  • 如果发动机热效率达到100%,一升汽油大概可以让汽车行驶多少公里?

    查看案例

  • 北京语言大学张爱玲教授被清华树木砸中逝世,清华回应系绿化养护人员违规作业所致,事故责任该如何划分?

    查看案例

  • 大家的NAS都是24小时不关机吗?

    查看案例

  • 群晖端部署了emby,盒子安装了客户端播放蓝光电影为什么不能显示影片自带字幕?

    查看案例

  • postgres集群的选择?

    查看案例