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


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

更新时间:2025-06-24 03:20:10

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

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
  • 你们是怎样看待警察这一职业的?

    查看案例

  • 手机的运行内存真的有必要上16GB吗?

    查看案例

  • 为啥苹果不给 MacBook Pro 加上这些特性?

    查看案例

  • 郑钦文的饭圈开始互撕,对郑钦文的名声有什么影响?郑钦文超话是否应该关闭?

    查看案例

  • 哪张照片让你觉得刘亦菲美得不可方物?

    查看案例

  • 你生活中做过最自律的一件事是什么?

    查看案例

  • 如何评价茅台暂停京东供货?

    查看案例

  • 如何评价《一人之下》第722(765)话情报?

    查看案例