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


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

更新时间:2025-06-22 04:05:10

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

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
  • 请问有人能估计一下 go 相比 php 在不同用户量下能省多少钱吗?

    查看案例

  • 你会从mac转向Windows吗?

    查看案例

  • 各位前端大触们,一般怎么定颜色的?

    查看案例

  • 怎样判断一个人的智商在你之上?

    查看案例

  • 做网页开发时,允许用户输入url图片地址来作为自己的头像有什么风险?

    查看案例

  • 只有我觉得.doc文件比.docx文件便捷吗?

    查看案例

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

    查看案例

  • 陌生人晕倒了,帮他拨打120后,病人不支付120出车费,这个费用谁来承担?

    查看案例