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

2025-06-23 12:45:13

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

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要标新立异用中括号?
广告位810*200
相关阅读
个人博客网站,要坚持多久才会有读者?

个人博客网站,要坚持多久才会有读者?

第三天就会有。 我说说我当时怎么做的: 1.首先要生成si...

2025-06-24
央企的信创,是否有必要把 spring 替换成国产的 solon ?

央企的信创,是否有必要把 spring 替换成国产的 solon ?

2021 年我亲自去现场部署过信创环境,某某档案系统。 J*...

2025-06-24
只想在家里电视上看看4k电影,有没有必要搞nas?

只想在家里电视上看看4k电影,有没有必要搞nas?

其实没有必要,无nas也可以看4K的。 分两种情况,第一种使...

2025-06-24
MacOS真的比Windows流畅吗?

MacOS真的比Windows流畅吗?

我现在公司配的机器,配置是绝对的大古董了 惠普z230sff...

2025-06-24
启用哪一个DNS网速最快?

启用哪一个DNS网速最快?

谷歌 8.8.8.8 腾讯 119.29.29.29 百度 ...

2025-06-24