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


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

更新时间:2025-06-27 21:25: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
  • 为什么 macOS 并不差,可市场总敌不过 Windows?

    查看案例

  • 大家如何看待有穆斯林患者要求输穆斯林同胞的血液,即输‘清真血’”这个事?

    查看案例

  • 妈妈去世后,外婆家的亲戚集体不来,我还要跟他们交往吗?

    查看案例

  • 搞了NAS之后去哪里下载4K,8K的电影?

    查看案例

  • 为什么m4max可以轻松堆128g显存,nvidia消费端显卡却长期被限制在24g?

    查看案例

  • 印度底层真的如地狱一般黑暗吗?

    查看案例

  • 苹果为什么要给每代MacOS起个名字,真以为人们记得住分得清吗?

    查看案例

  • 导师给了1.4W要我给工作室买个主机,是整机还是自己配?

    查看案例