作为独立开发者,有哪些可以分享的经验?
linux字体显示为什么还做不到像android一样清晰?
Office和WPS哪个好用些?
现在独立开发 Win 和 Mac 跨平台的桌面程序,Qt 是最佳选择吗?
京东刘强东近期小范围分享怎么看?
美国打击伊朗 3 处核设施,美国为什么此时介入?中东局势会升级吗?

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

发布日期:2025-06-23 22:20:16 浏览次数:0

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

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要标新立异用中括号?