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


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

更新时间:2025-06-21 18: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
  • 如何看待华为Pura80标准版手机接口竟倒退成USB 2.0?要是也烧了WIFI是不是不好备份数据?

    查看案例

  • 为什么“柴犬”从万人迷,变成万人嫌?

    查看案例

  • 特斯拉宣布将于 6 月 22 日开始 Robotaxi 公开试运营,这将对自动驾驶行业带来哪些影响?

    查看案例

  • 这个社会为什么老实人都混得不好?

    查看案例

  • 为什么那么多人用GO?GO语言的优势在哪里?

    查看案例

  • 请问27寸4K显示器哪个好呀?

    查看案例

  • 日本AV对中国人的毒害有多大?

    查看案例

  • 男朋友说我穿裙子不要敞开腿坐这是他底线,我该怎么办?

    查看案例