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


大部分语言都用尖括号<>表示泛型,为什么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
  • 现在工作中k8s是使用containerd还是docker来管理容器?

    查看案例

  • 乔丹的身体素质放到现在是不是只能算平庸?

    查看案例

  • 为什么欧美影视喜欢露点?

    查看案例

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

    查看案例

  • 鸿蒙电脑应用开发和鸿蒙手机是一样的吗?

    查看案例

  • 电脑开机经常出现这个问题,求解是是什么原因导致呀?

    查看案例

  • 做引体向上可能会诱发腰肌劳损吗?

    查看案例

  • 养乌龟是什么体会?

    查看案例