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

2025-06-26 06:45:15

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

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-28
伊朗宣布取得对以作战胜利,从这场冲突的现状及影响看,到底谁赢了,谁吃了大亏?

伊朗宣布取得对以作战胜利,从这场冲突的现状及影响看,到底谁赢了,谁吃了大亏?

从战场成果来看,以色列炸了人家的核设施,团灭伊朗的军方高层,...

2025-06-28
微软会撤离中国吗?

微软会撤离中国吗?

其实已经算是撤离了。 商务部召开美资企业圆桌会叫了特斯拉、...

2025-06-28
Camtasia Studio软件应用求助?

Camtasia Studio软件应用求助?

Cаmтаsia-2025.1.2.9686-Setup∕C...

2025-06-28
obsidian用一两年后会有多大?全文搜索还快吗?

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

用内存虚拟化方案就可以了。 因为 Obsidian 对于 ....

2025-06-28