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


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

更新时间:2025-06-18 22:00:12

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

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
  • 作为一个服务器,node.js 是性能最高的吗?

    查看案例

  • 为什么欧美影视喜欢露点?

    查看案例

  • 58 同城被曝大规模裁员,比例或达 30%,具体情况如何?58 同城目前面临哪些问题?

    查看案例

  • 冬天也要穿胸罩吗?

    查看案例

  • 如何评价中国电科研发的JY-10防空指挥控制系统成为伊朗防空指挥系统核心?

    查看案例

  • 为什么bilibili后端要用go来写?

    查看案例

  • 琼瑶剧中哪些经典台词让你印象深刻?哪些经典场景让你记忆犹新?

    查看案例

  • 为什么中国现在全球军事实力第一,但包括中国人在内很多人不认可?

    查看案例