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


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

更新时间:2025-06-22 02:40: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
  • 如何评价ReactOS?

    查看案例

  • 为什么现在的中国电影越来越烂?

    查看案例

  • 有哪些看似聪明,实则很傻的行为?

    查看案例

  • 想开一个100cm或者120cm的溪流缸或者水草缸,有没有大佬指导一下,有哪些注意事项?

    查看案例

  • 浙江是否已经达到发达国家水平?

    查看案例

  • 现代艺术只考虑意义、不考虑美感吗?

    查看案例

  • 极客湾评价小米芯片客观么?

    查看案例

  • 如何看待“Hutool”工具类库广受欢迎?

    查看案例