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


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

更新时间:2025-06-24 02:50: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
  • 如何评价微信新版语音界面设计?你喜欢吗?

    查看案例

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

    查看案例

  • 怎么评价国内AI企业人肉背15块80TB硬盘,飞去马来西亚用英伟达训练数据,以规避美国禁令?

    查看案例

  • 做数据库内核开发的是不是很少?

    查看案例

  • 你最满意的10款 PC 软件是什么?

    查看案例

  • PHP 已经诞生 30 年,它对你意味着什么?

    查看案例

  • 为什么 php 可以做到 7 毫秒以内响应,而 .net 做不到?

    查看案例

  • 能不能发一张你相册里最好看的自拍照?

    查看案例