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

2025-06-23 21:20:12

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

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
相关阅读
普通人的电脑配置到底是什么水平?

普通人的电脑配置到底是什么水平?

以前当垃圾佬的时候特地去电脑店打工练练手,当时以为天天装12...

2025-06-24
年纪轻轻为什么会得腰肌劳损?

年纪轻轻为什么会得腰肌劳损?

知道什么是腰肌劳损吗?不要随便给自己按病! 腰肌劳损这个词大...

2025-06-24
为什么这么多人讨厌中国移动?

为什么这么多人讨厌中国移动?

是时候祭出大杀器了: 移动用户:使用本机编辑短信“CXXZ#...

2025-06-24
Electron 做游戏客户端的潜力有多大?

Electron 做游戏客户端的潜力有多大?

Electron既不是游戏引擎,也不是新时代,也不会带来变革...

2025-06-24
软路由是否被过度神化?

软路由是否被过度神化?

有一说一openwrt我真玩不来,原生还好,想玩插件总会遇到...

2025-06-24