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


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

更新时间:2025-06-21 16:35:12

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

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
  • 鱼缸能不能做到一直不换水还很清澈?

    查看案例

  • 为什么年轻的肉体让人沉迷?

    查看案例

  • 韩国人为什么处处与中为敌,难道他们不知道自己是芝麻小的小国吗?

    查看案例

  • 网络小白如何建立一个网站,供别人下载文件(主要是PDF和MP3)?

    查看案例

  • 程序员平时都是CRUD开发工作,真的需要深入理解原理性的知识点吗?

    查看案例

  • 为什么负荷那么大的腰部力量训练的人不会受伤,长期无载荷久坐的人会出现腰肌劳损?

    查看案例

  • 马景涛这些年到底经历了什么?

    查看案例

  • obsidian用一两年后会有多大?全文搜索还快吗?

    查看案例