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


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

更新时间:2025-06-23 04:15:19

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

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
  • 都说苹果是细节狂魔,那苹果有没有细节其实做的很差的点?

    查看案例

  • 网传广东怀集洪水后赵一鸣超市被哄抢,县***回应相关单位正在核实,若属实哄抢者该承担哪些法律责任?

    查看案例

  • 一米二的棍子打的赢三十厘米的刀子吗?

    查看案例

  • 丰田将中国市场决策权交给中方,是在华战略重大调整,这会不会意味着未来中国市场的丰田车“中味”十足了?

    查看案例

  • 有人说24GB和48GB内存容量是新一代电脑平台最均衡的方案,真的是这样吗?电脑内存应该如何选?

    查看案例

  • 如何评价《灵笼 2》第六集?

    查看案例

  • SpaceX 预计 2025 年收入将达到 155 亿美元,背后的原因是什么?

    查看案例

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

    查看案例