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

Views :
Update time : 2025-06-19 09:25:15

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

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-18 06:20:09
男人为什么到了一定年纪就喜欢喝酒?...
Blog Post With Youtube Video 历史上有哪些被认为失传的书籍后来又被找到?
2025-06-18 07:05:10
历史上有哪些被认为失传的书籍后来又被找到?...
Blog Post With Youtube Video 如何看待光线传媒董事长称《哪吒 2》票房分账最不公平,100 块票房片方只拿 33 块?怎么分才合理?
2025-06-18 06:05:10
如何看待光线传媒董事长称《哪吒 2》票房分账最不公平,100 块票房片方只拿 33 块?怎么分才合理?...
Blog Post With Youtube Video 大数据最核心的价值是什么?
2025-06-18 06:45:09
大数据最核心的价值是什么?...

Leave Your Message