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

2025-06-25 15:55:13

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

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
相关阅读
为什么都说 Finder 难用?

为什么都说 Finder 难用?

explorer和finder这俩货,其实都挺抽象的。 我来...

2025-06-24
有哪些适合编程用的显示器?

有哪些适合编程用的显示器?

联合创新(Innocn)27.6英寸Nano IPS 16:...

2025-06-24
华为 HDC 发布 HarmonyOS 6 开发者 beta 版对应用开发者和鸿蒙生态有哪些影响?

华为 HDC 发布 HarmonyOS 6 开发者 beta 版对应用开发者和鸿蒙生态有哪些影响?

鸿蒙系统的推出已经有一段时间了,目前来看华为已经有多款设备搭...

2025-06-24
生完孩子身材依旧火辣是一种怎样的体验?

生完孩子身材依旧火辣是一种怎样的体验?

真的xswl,这个问题下某答主盗图,我说了一句“这个答主的过...

2025-06-24
组有线mesh,一定要把光猫改桥接吗?

组有线mesh,一定要把光猫改桥接吗?

你这个接法根本就不能上网,光猫不打开DHCP,主路由就获取不...

2025-06-23