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


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

更新时间:2025-06-19 08:00:11

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

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
  • 为什么日本人室内光脚啊?他们屋子里有这么干净吗?

    查看案例

  • 中国大陆地区献血率为何如此低下?

    查看案例

  • 如何看待演员夏雨称「真正玩极限运动的都是胆小的人」,如何理解这一观点?

    查看案例

  • 为什么日本经济下降,大学排名跌至谷底,还有那么多人挤破脑袋去日本留学?

    查看案例

  • 如何看待,小米汽车用消费级8gen3soc替代车规级芯片?

    查看案例

  • PHP和Node.js哪个更爽?

    查看案例

  • 你被哪个后来知道很sb的BUG困扰过一周以上吗?

    查看案例

  • 怎么评价国内AI企业人肉背15块80TB硬盘,飞去马来西亚用英伟达训练数据,以规避美国禁令?

    查看案例