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


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

更新时间:2025-06-22 12: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
  • 如何评价仓颉编程语言7月30日开源?

    查看案例

  • mysql每天有1千万数据 怎么办?分表吗 有什么好的方案。?

    查看案例

  • 被裁员是怎样的一种体验?

    查看案例

  • 你理想中的完美户型长什么样?

    查看案例

  • 用GraphQL如何实现以下API请求?与REST的思路相比实现方法孰优孰劣?

    查看案例

  • 哪一句话让你沉默了很久?

    查看案例

  • 为什么不用rust重写Nginx?

    查看案例

  • 本人女20,平胸跟男生一样怎么办 ?

    查看案例