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


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

更新时间:2025-06-23 01:40:15

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

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
  • 为什么都认为无GC语言一定会比有GC语言要快?

    查看案例

  • 如何评价 Vue.js 纪录片?

    查看案例

  • 腰肌劳损怎嘛治啊?

    查看案例

  • 刘强东看到了什么,才去搞外卖?

    查看案例

  • 当初中俄为什么不摧毁朝鲜的核设施,让朝鲜拥有了自己的核武器?

    查看案例

  • 给孩子讲题为什么容易急眼?

    查看案例

  • Electron 做游戏客户端的潜力有多大?

    查看案例

  • RUST的WEB开发真的能用于生产吗?

    查看案例