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

2025-06-19 06:40:10

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

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
相关阅读
你身边身材最好的女生是什么样?

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

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

2025-06-28
什么样的人算是中了基因***?

什么样的人算是中了基因***?

在天津认识的一个姑娘,裸高178,头身比我觉得不是九头身也算...

2025-06-28
为什么Steam Deck能做好Windows游戏转译但是Apple Mac就做不好?

为什么Steam Deck能做好Windows游戏转译但是Apple Mac就做不好?

SD转译Win游戏的难度跟Mac比根本不是一个量级的。 SD...

2025-06-28
日本AV对中国人的毒害有多大?

日本AV对中国人的毒害有多大?

我觉得AV最大的价值在于,它帮助男性对高颜值女性祛魅。 我...

2025-06-28
为什么外卖小哥更愿意选九号、小牛呢?

为什么外卖小哥更愿意选九号、小牛呢?

那只是你觉得。 实际上只有众包选手选择九号。 团队很少有...

2025-06-28