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


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

更新时间:2025-06-23 22:20: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
  • 伊朗议会赞成关闭霍尔木兹海峡,会动真格吗?若霍尔木兹海峡关闭,将带来哪些影响?

    查看案例

  • 055万吨驱逐舰是不是有些被过于神化了,有没有了解的大佬详细解释一下?

    查看案例

  • Windows 下有什么用过之后就离不开的冷门软件?

    查看案例

  • 我是新手想养鱼,预算不超过200。有什么好的建议或者禁忌吗。?

    查看案例

  • 你看过哪些以为是段子新闻,结果发现居然是真的?

    查看案例

  • 前端初学者如何学习css及页面布局?

    查看案例

  • 如有如此漂亮的女友,该怎么办,才能不弄丢?

    查看案例

  • 27℃ 的冷空调和 27℃ 的热空调有什么区别?

    查看案例