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

2025-06-25 14:55: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
相关阅读
为什么现在科技热点是GPU,不是CPU了?

为什么现在科技热点是GPU,不是CPU了?

我又要点名一款软件:Chrome Chrome的诞生,某种意...

2025-06-24
40岁财务自由想找个25左右的媳妇儿有可能吗?

40岁财务自由想找个25左右的媳妇儿有可能吗?

拿50万大学城投资开个便利店,自己只招人看得过去的,每月休息...

2025-06-24
为什么市场不制作***黄油?

为什么市场不制作***黄油?

这个问题吸引到了我,一下子让我梦回青春,当年《梦幻***馆》...

2025-06-24
为什么有些NAS用户弄那么多硬盘?

为什么有些NAS用户弄那么多硬盘?

2001年的某个人信息,目前互联网只剩一句话。 2004年...

2025-06-24
胖东来能长久下来吗?

胖东来能长久下来吗?

公司跟胖东来有业务往来,但一直都是通过代理商做的,今年年初曾...

2025-06-24