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

2025-06-20 16:45:18

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

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
相关阅读
老板说我设计了一周的海报还是不行,我到底该怎么学啊?

老板说我设计了一周的海报还是不行,我到底该怎么学啊?

如果你老板要求不高的话,还可以抢救一下,但是也得学一段时间 ...

2025-06-21
Flutter 为什么没有一款好用的UI框架?

Flutter 为什么没有一款好用的UI框架?

有, 而且很高质量! (辛苦整理全是收藏,没有关注点赞和评论...

2025-06-21
什么才是真正的爱情?

什么才是真正的爱情?

在吉林,有这么个男子,和女友谈了6年恋爱,期间花在女友身上的...

2025-06-21
低功耗web服务器 迷你主机 小型服务器 求推荐?

低功耗web服务器 迷你主机 小型服务器 求推荐?

原来的设备:待机都35~40多瓦,按50瓦算,一年50 x ...

2025-06-21
为什么腾讯云或者阿里云不让自建dns服务器?

为什么腾讯云或者阿里云不让自建dns服务器?

公共DNS算电信业务,自建且不备案就是违规经营电信业务电信业...

2025-06-21