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


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

更新时间:2025-06-21 23:00:17

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

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
  • docker如何查看 容器启动的run命令?

    查看案例

  • 理论上flutter性能应该非常高才对,为什么好些flutter应用性能一般?

    查看案例

  • 如何看待不超过1879元的Mac mini(M4+16/256GB+票),易用性吊打同级其他台式电脑?

    查看案例

  • 独立开发***能盈利吗?感觉好累...

    查看案例

  • 要想完全放弃Windows操作系统而使用 Linux需要多少勇气?

    查看案例

  • 什么时候你开始发现俄罗斯不过如此?

    查看案例

  • 我的世界怎么租一个四个人的服务器?

    查看案例

  • 明星现实中真的很漂亮吗?

    查看案例