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


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

更新时间:2025-06-20 22:30: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
  • switch2好用吗朋友们?

    查看案例

  • 怎么才能有尤雨溪一半强,该怎么学习?

    查看案例

  • 公司准备换系统有什么好用的ERP系统推荐嘛?

    查看案例

  • Linux内核代码大佬们如何观看的?

    查看案例

  • 既然巴菲特的持仓是公开的,为什么我们不能跟着巴菲特买呢?

    查看案例

  • 如何评价大胃袋良子?

    查看案例

  • “哨兵模式”涉嫌泄密,你支持封杀特斯拉吗?

    查看案例

  • 吃爽了是怎样一种体验?

    查看案例