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

2025-06-22 22:50: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要标新立异用中括号?
广告位810*200
相关阅读
PHP现在真的已经过时了吗?

PHP现在真的已经过时了吗?

php除了一个wordpress等少数几个生态没被取代,其余...

2025-06-26
你身边身材最好的女生是什么样?

你身边身材最好的女生是什么样?

去游泳的时候见过一个,165左右,小头宽肩细腰胯宽腿直肤白,...

2025-06-26
你自己觉得自己的身材好吗?

你自己觉得自己的身材好吗?

不好。 虽然我177高,但我胖啊,,最胖时候有87公斤吧,...

2025-06-26
怎么才能有尤雨溪一半强,该怎么学习?

怎么才能有尤雨溪一半强,该怎么学习?

目前已经有人成功把chrome124移植到xp系统上运行了,...

2025-06-26
搞了NAS之后去哪里下载4K,8K的电影?

搞了NAS之后去哪里下载4K,8K的电影?

回答里一大半是广告。 qBittorrent,加BT***...

2025-06-26