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


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

更新时间:2025-06-23 04:15:19

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

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
  • 为什么几乎没人用电视屏幕连主机或者笔记本当显示器?

    查看案例

  • 求大神解答,为什么大家都不喜欢用docker?

    查看案例

  • 阿里云为什么没有一年的免费云服务?

    查看案例

  • 折叠屏手机有哪些有用或好玩的功能,你过去不理解,现在离不开?

    查看案例

  • 在现实中,普通人仿照***《一拳超人》中琦玉老师的锻炼方法锻炼三年会怎么样?

    查看案例

  • 《流浪地球 3》官宣马丽加入,对于她的表现你有哪些期待?

    查看案例

  • 为什么微软还没有倒闭?

    查看案例

  • 选mac还是高端windows?

    查看案例