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


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

更新时间:2025-06-20 21:40:16

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

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
  • 鱼缸里突然在水面角落出现很多想泡沫一样的气泡是怎么回事?

    查看案例

  • 如何评价中国电科研发的JY-10防空指挥控制系统成为伊朗防空指挥系统核心?

    查看案例

  • 为什么腾讯云或者阿里云不让自建dns服务器?

    查看案例

  • ***如古代长城用的是C140混凝土,那千百年下来会完整的留存至今还是损坏的更加严重?

    查看案例

  • 如何评价网传那尔那茜高考179分考入上海戏剧学院***?

    查看案例

  • 大家猜猜伊朗的结局如何?

    查看案例

  • 如何客观评价李小冉的长相?

    查看案例

  • 来自东北人的疑惑,南方的菜分量到底有多小?

    查看案例