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


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

更新时间:2025-06-22 20:30: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
  • 编程语言 MoonBit 发布 Beta 版,正式进入企业场景应用,会带来哪些影响?

    查看案例

  • 男朋友说我穿衣服太开放,难道好身材不应该显示出来吗?

    查看案例

  • 男人最无声的炫耀是什么?

    查看案例

  • Python 开发中如何进行文件读写操作?

    查看案例

  • 广东怀集遇历史最大洪水,18 万人受灾,积水最深处达 3 米,目前当地情况如何?

    查看案例

  • 如何看待机器之心重测高考数学全卷,Gemini夺冠,豆包DeepSeek并列第二?

    查看案例

  • 如何看待人民日报官方微信公众号转载的文章《孩子,我宁愿欠你一个快乐的少年,也不愿看到你卑微的成年》?

    查看案例

  • 如何评价高圆圆的身材算是美女类型的吗?

    查看案例