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

Views :
Update time : 2025-06-24 12:45: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要标新立异用中括号?
Related News
Read More >>
Blog Post With Youtube Video 为什么好多人不承认大众审美就是喜欢白皮?
2025-06-25 12:10:18
为什么好多人不承认大众审美就是喜欢白皮?...
Blog Post With Youtube Video 如何看待基层年轻公务员抓住一切机会想要逃离基层的现象?
2025-06-25 13:35:17
如何看待基层年轻公务员抓住一切机会想要逃离基层的现象?...
Blog Post With Youtube Video 为什么幼儿园的超前教育被叫停?
2025-06-25 12:00:17
为什么幼儿园的超前教育被叫停?...
Blog Post With Youtube Video 为什么鱼缸老是起绿藻呢,有什么好办法不用整天擦鱼缸?
2025-06-25 13:00:18
为什么鱼缸老是起绿藻呢,有什么好办法不用整天擦鱼缸?...

Leave Your Message