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

2025-06-21 17:45:17

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

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-20
Python+rust会是一个强大的组合吗?

Python+rust会是一个强大的组合吗?

不不不,把python去掉,只用rust。 组合个毛线啊,...

2025-06-20
以色列为什么要打伊朗?

以色列为什么要打伊朗?

这叫中国的国运。 每次美国准备干中国,总是后院起火。 20...

2025-06-20
为什么中国主机带宽比美国贵5倍(原来错误的10000倍),比如阿里云?

为什么中国主机带宽比美国贵5倍(原来错误的10000倍),比如阿里云?

阿里腾讯抖音都非常想自建骨干网城域网,在每个城市最后几公里十...

2025-06-20
华为Pura 80首销遇冷,是否说明消费者已经开始对麒麟芯片性能有所觉醒?

华为Pura 80首销遇冷,是否说明消费者已经开始对麒麟芯片性能有所觉醒?

我倒是觉得主要问题在鸿蒙上,单位里同事全都没升级。 唯一体...

2025-06-20