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

2025-06-21 17:15: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
相关阅读
以色列为什么要打伊朗?

以色列为什么要打伊朗?

我来一次性说清楚,请相信我,n年前作为专业的文科生,我特别研...

2025-06-21
如何看待海贼王1152话尾田给出的香克斯断臂的解释?

如何看待海贼王1152话尾田给出的香克斯断臂的解释?

网友的推断很合理: 1、红发断臂的BUG是尾田在听从集英社编...

2025-06-21
为什么个人需要公网ip?

为什么个人需要公网ip?

前段时间出门旅行了一周,回来后我老婆反映刷抖音网络卡,问我怎...

2025-06-21
7700XT和4060TI哪个好?

7700XT和4060TI哪个好?

明明就一个查timespy分表的事情,一群人能yy半天 ...

2025-06-21
Swift 和同时代的其他语言比起来怎么样?

Swift 和同时代的其他语言比起来怎么样?

我觉得Swift最强的是无缝集成C,制作完XCFramewo...

2025-06-21