养乌龟只养一只,它觉得会孤独吗?
宁波东方理工大学学费每人每学年 9.6 万,为什么会这么贵?
35岁不想奋斗只想躺平怎么办?
obsidian用一两年后会有多大?全文搜索还快吗?
同事间的「奶茶社交」到底弊大于利还是利大于弊?作为职场新人,该如何应对这种社交方式?
一个非常漂亮的残疾女孩,会有人愿意娶吗?

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

发布日期:2025-06-18 16:10:13 浏览次数:0

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

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要标新立异用中括号?