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


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

更新时间:2025-06-20 19:00: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
  • 尼康的镜头里哪款拍摄人像好呢?

    查看案例

  • 你们在Notion、Obsidian、Logseq三者中如何选择?将哪个作为主力笔记软件?为什么?

    查看案例

  • 使用Rust开发游戏是一种怎样的体验?

    查看案例

  • 问:Pr真的能免费用吗??

    查看案例

  • k8s里面kubectl get pod -d wide命令作用是什么?

    查看案例

  • 大家有没有「大众认为是烂片但个人却喜欢看」的影片?

    查看案例

  • 前端如何设计网页?

    查看案例

  • 孩子上小学,考了年级第一,亲戚总说高中好才算数,是真的吗?

    查看案例