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


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

更新时间:2025-06-20 22:30: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
  • 西方人是怎么发现地球是圆的的?

    查看案例

  • MySQL不香吗,为啥还要Elasticsearch?

    查看案例

  • 如何评价“寡姐”斯嘉丽·约翰逊的身材?

    查看案例

  • 美国真会下场对伊朗开战吗?

    查看案例

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

    查看案例

  • 有没有一个时间段,自己乐在其中,可亲人或者朋友却觉得你很辛苦,很心疼你?

    查看案例

  • 工业克苏鲁什么意思?

    查看案例

  • 张飞为啥被评价有国士之风?

    查看案例