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


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

更新时间:2025-06-22 04:05:10

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

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
  • 蔡澜曾说「年轻人要存到 100 万以上,这是脱离牛马生活的第一步」,怎样看这一观点?

    查看案例

  • 27寸显示器有必要上4K吗?

    查看案例

  • IT行业夫妻双双被裁,想去新西兰闯一闯可以吗?

    查看案例

  • 如何评价《一人之下》722(765)话?

    查看案例

  • 你怎么看老谢举报李雪琴这件事?

    查看案例

  • 你的低成本爱好是什么?

    查看案例

  • 我是一名云计算专业的学生,正面临着毕业设计,我想选择设计网页,各位大神有什么建议?

    查看案例

  • 为什么广东人敢生?对别的省份提高生育率有哪些可借鉴学习之处?

    查看案例