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


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

更新时间:2025-06-25 15:55: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
  • 如何评价《灵笼 2》第六集?

    查看案例

  • 如何看待 Rust 的应用前景?

    查看案例

  • 微软edge浏览器为什么逐渐被其他的浏览器代替?

    查看案例

  • 北京语言大学张爱玲教授被清华树木砸中逝世,清华回应系绿化养护人员违规作业所致,事故责任该如何划分?

    查看案例

  • 为什么百度搜索引擎越做越差?

    查看案例

  • 为什么MacBook pro不用高刷新率的屏幕?

    查看案例

  • 核武器真的有宣传中那么牛逼吗?

    查看案例

  • 怎么才能有尤雨溪一半强,该怎么学习?

    查看案例