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


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

更新时间:2025-06-25 12:05: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
  • 瘦真的只能饿出来吗?

    查看案例

  • 如何评价阿里等大厂笔试现已经禁用本地IDE?

    查看案例

  • 世界上存在动漫少女般完美的「身体」吗?

    查看案例

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

    查看案例

  • 有什么工具可以批量更改文件名?

    查看案例

  • 有些家长可以恶心到什么程度?

    查看案例

  • 下一代 Xbox 主机售价可能超过 1000 美元,对此你怎么看?值得入手吗?

    查看案例

  • web大作业,一头雾水,求指点~~?

    查看案例