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

2025-06-22 22:15:16

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

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
相关阅读
理论上flutter性能应该非常高才对,为什么好些flutter应用性能一般?

理论上flutter性能应该非常高才对,为什么好些flutter应用性能一般?

自研新作 flutter3.32+dart3.8+deeps...

2025-06-25
字节跳动辞退原豆包大模型负责人,曾被曝婚内出轨下属,怎样看待这一处理结果?

字节跳动辞退原豆包大模型负责人,曾被曝婚内出轨下属,怎样看待这一处理结果?

我想起了阿里的蒋太子 昨天的新闻:阿里架构调整——饿了么、飞...

2025-06-25
请问群晖的docker还能装些什么?

请问群晖的docker还能装些什么?

可以试试Emby套件,加docker安装Sonarr+Jac...

2025-06-25
你是在什么时候认识到自己好看的?

你是在什么时候认识到自己好看的?

我其实一直觉得自己很丑,长得像男孩。 身边的好朋友也一直跟我...

2025-06-25
现在有没有可能在地球某处隐藏一个大型军事基地而几十年不被发现?

现在有没有可能在地球某处隐藏一个大型军事基地而几十年不被发现?

大隐隐于市就行了。 杭州有个笕桥军用机场谁都知道,毕竟一天...

2025-06-25