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


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

更新时间:2025-06-26 08:55:13

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

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
  • 为什么中国盛产“巨婴”,一到国外就通情达理?

    查看案例

  • 央企的信创,是否有必要把 spring 替换成国产的 solon ?

    查看案例

  • 汤姆·克鲁斯在国外算几线?

    查看案例

  • 福建舰正在加紧进行海试,福建舰入列后能发挥怎样的作战效能?我国三艘航母各有哪些特点?

    查看案例

  • 鱼缸里突然在水面角落出现很多想泡沫一样的气泡是怎么回事?

    查看案例

  • 以色列是如何从三天前的不可一世要灭了伊朗到今天的哭哭啼啼要“为生存而战”的?

    查看案例

  • golang为什么要内置map?

    查看案例

  • 鸿蒙折叠屏笔记本为什么敢卖26999?

    查看案例