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


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

更新时间:2025-06-23 20:15:11

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

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
  • 跟离异的女同事聊天时,她冒出一句:「你老婆还不如我,离了跟我过得了」,我该怎么回答?

    查看案例

  • 如何评价B站女主播“酒酿Lily王、Maggieyoo、水兵月野兔兔、CC宝玉玉、唐卡七”集体封禁?

    查看案例

  • 马上领证了,发现男朋友离不了游戏,让他少打游戏他会非常生气,正常吗?

    查看案例

  • 为什么我觉得中国很谦虚,甚至有时候感觉中国对其他国家过分宽容,外国人却认为中国是列强呢?

    查看案例

  • 使用J***a开发简单CAD软件?

    查看案例

  • 为什么好多人不承认大众审美就是喜欢白皮?

    查看案例

  • 女孩子第一次穿高跟鞋是什么体验?

    查看案例

  • 中国站在俄罗斯和伊朗这边是很难启齿的事吗?

    查看案例