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

2025-06-23 12:15:18

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

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
相关阅读
多个充电宝或电芯品牌的 3C 认证证书被暂停,涉及罗马仕、安克、绿联、倍思、安普瑞斯等,发生了什么?

多个充电宝或电芯品牌的 3C 认证证书被暂停,涉及罗马仕、安克、绿联、倍思、安普瑞斯等,发生了什么?

最新消息,民航局一刀切了,没3C不得带上飞机。 问题在于充...

2025-06-26
现在蒙古人会不会后悔当年的独立?

现在蒙古人会不会后悔当年的独立?

外蒙古人是否后悔我不清楚,但我可以肯定的是, 直到80年代末...

2025-06-26
有人对sse(server sent events)了解的吗?

有人对sse(server sent events)了解的吗?

J***aScript提供了一种SSE(Server-sen...

2025-06-26
在微软(Microsoft)工作是怎样一番体验?

在微软(Microsoft)工作是怎样一番体验?

休***中,就聊聊休***吧。 MS休***政策非常人性化...

2025-06-26
微软宣布 5 月 28 日开始下架「Microsoft 远程桌面」应用,背后原因有哪些?

微软宣布 5 月 28 日开始下架「Microsoft 远程桌面」应用,背后原因有哪些?

新版Windows App直接 在windows平台上单独放...

2025-06-26