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

2025-06-19 08:00:11

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

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
相关阅读
有哪些BI工具惊艳了你?

有哪些BI工具惊艳了你?

当你看过很多后,你就会发现,谁都没有什么惊艳的,图形都差不多...

2025-06-19
颈椎生理曲度变直可以通过运动康复吗?

颈椎生理曲度变直可以通过运动康复吗?

来门诊看颈椎不适、活动不利的年轻人特别多, 他们的颈椎X线片...

2025-06-19
为什么都说武器越怪,死的越快?

为什么都说武器越怪,死的越快?

我高中好哥们有个富二代混子 他平时的随身武器是一把车钥匙 老...

2025-06-19
目前最具性价比的全栈路线是啥?

目前最具性价比的全栈路线是啥?

肯定是all in J***a,前端的话随便学学就行了,还有...

2025-06-19
哪张照片让你觉得刘亦菲美得不可方物?

哪张照片让你觉得刘亦菲美得不可方物?

那自然是刘亦菲打枪图: 这颜值,这发量,这腰身,这曲...

2025-06-19