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


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

更新时间:2025-06-19 19:25:11

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

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
  • Golang 的 Web 框架该怎么选择?Web 开发又该怎样学?

    查看案例

  • J***aScript 这种语言特性十分糟糕的语言流行起来是不是一场灾难?

    查看案例

  • go 有哪些成熟点的后台管理框架?

    查看案例

  • 人工智能相关专业里有什么「坑」吗?

    查看案例

  • 如何看待alist被转手出售***?

    查看案例

  • 国产轮胎那么便宜,为什么很多人非要买高价的国外轮胎??

    查看案例

  • 有没有什么办法可以让双系统同时运行?

    查看案例

  • 30岁了,你在深圳过着什么样的生活?

    查看案例