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

2025-06-22 01:20: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
相关阅读
为什么中国红十字会腐败这么严重?

为什么中国红十字会腐败这么严重?

1.郭美美*** 2.红十字直升机送餐*** 3.上海红...

2025-06-21
为什么一部分 Go 布道师的博客不更新了?

为什么一部分 Go 布道师的博客不更新了?

哈哈,首先我不是布道师,算是 go 语言的爱好者吧。 😄 自...

2025-06-21
如何评价网易国产动作冒险单机新作《归唐》首支预告片?

如何评价网易国产动作冒险单机新作《归唐》首支预告片?

看了下首发PV,这次网易游戏的《归唐》背景故事是放在一个比较...

2025-06-21
有什么好用的安卓本地音乐播放器推荐?

有什么好用的安卓本地音乐播放器推荐?

开源音乐播放软件,薄荷音乐 ***地址 ***s://sod...

2025-06-21
rust 解决了什么问题?

rust 解决了什么问题?

很多人讨论rust能不能解决内存bug,关于这一点我觉得c+...

2025-06-21