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


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

更新时间:2025-06-21 20:05: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
  • 为什么苹果公司无法制造出性价比高的 Mac 电脑?

    查看案例

  • 2025年6月了,深圳房价咋样?

    查看案例

  • 如何评价Orbstack(在Mac上低开销地运行容器和Linux)?

    查看案例

  • 普通家庭对孩子最好的托举是什么呢?

    查看案例

  • 前端因为像素还原设计稿而离职,这是个别现象吗?

    查看案例

  • 华为自研的仓颉编程语言将于 7 月 30 日开源,这款语言将如何影响未来的开发趋势?

    查看案例

  • 为什么很多时候对女儿最狠的却是母亲?

    查看案例

  • 坚持使用 PHP 的你,如今有什么感悟?

    查看案例