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


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

更新时间:2025-06-18 14:35:14

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

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
  • 男朋友说我穿衣服太开放,难道好身材不应该显示出来吗?

    查看案例

  • 如何系统地学习Rust语言?

    查看案例

  • 国内哪家waf设备比较靠谱?

    查看案例

  • 有哪些瞬间你秒懂了别人的暗示?

    查看案例

  • 普通人用得着4k分辨率的显示器吗?

    查看案例

  • 为什么烤包子难出新疆?

    查看案例

  • 互联网研发运维都必用的Nginx到底是什么呢?

    查看案例

  • 鱼缸氨氮含量低,但是硝酸盐和亚硝酸盐爆表,已经一个多周了,咋办?

    查看案例