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


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

更新时间:2025-06-22 22:50:12

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

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
  • 如何评价海信激光电视新发布的探索 X1,是否能重新定义家庭***标准?

    查看案例

  • 在办公室用机械键盘是什么心里?

    查看案例

  • 为什么女性内衣很少有人穿前扣的?

    查看案例

  • 印度是真的烂还是咱们在信息茧房里面?

    查看案例

  • 为什么同样是输球,常州和国足的风评却差那么多呢?

    查看案例

  • 美国搞出个“稳定币”,到底是什么?其它国家是如何看待稳定币的?

    查看案例

  • 为啥“亮亮丽君夫妇”总有吃不完的苦?

    查看案例

  • 小米发布了 REDMI 首款旗舰小平板 K Pad,仅 8.8 英寸,小巧便携,如何评价这一设计?

    查看案例