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


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

更新时间:2025-06-20 16:45:18

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

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
  • 空输部队为全斗焕干了这么多脏活累活,士兵有没有什么优待?

    查看案例

  • 小米的研发经费真的很少吗?

    查看案例

  • 空输部队为全斗焕干了这么多脏活累活,士兵有没有什么优待?

    查看案例

  • 美国军队只有司令,不设政委,它们的文官治军咋实现的?

    查看案例

  • golang为什么要内置map?

    查看案例

  • 以色列为什么要打伊朗?

    查看案例

  • 刘强东称「京东外卖很快就会出来一个跟美团完全不同的商业模式」,如何看待此回应?

    查看案例

  • 有一个***约你出去,你会去吗?

    查看案例