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


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

更新时间:2025-06-23 00:30:12

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

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
  • 为什么欧美影视喜欢露点?

    查看案例

  • 今天在用剪映剪***被一个会Premiere的同学看到了,嘲笑我用剪映,Pr剪辑真的比剪映好吗,好在哪?

    查看案例

  • 要不要帮导师装服务器?

    查看案例

  • iOS的墓碑机制这么厉害,为什么Windows、Linux不***用呢?

    查看案例

  • 你都见过什么样的电脑盲?

    查看案例

  • 平面设计师要被时代淘汰了吗?

    查看案例

  • 如何评价杨立昆认为大模型只是对海量文本的模式进行复杂拟合,根本不懂意义?

    查看案例

  • 以前的日漫都这大胆的吗?

    查看案例