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

Views :
Update time : 2025-06-18 22:40:11

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

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-21 20:55:11
国家电网不再全额收购可再生电力,光伏怎么生存啊?...
Blog Post With Youtube Video 男朋友说我穿衣服太开放,难道好身材不应该显示出来吗?
2025-06-21 22:25:10
男朋友说我穿衣服太开放,难道好身材不应该显示出来吗?...
Blog Post With Youtube Video ***如古代长城用的是C140混凝土,那千百年下来会完整的留存至今还是损坏的更加严重?
2025-06-21 20:50:10
***如古代长城用的是C140混凝土,那千百年下来会完整的留存至今还是损坏的更加严重?...
Blog Post With Youtube Video 湖南龙山一小区车库被淹,4 名业主移车失联其中 3 人遇难,有何警示意义?遇到暴雨有哪些注意事项?
2025-06-21 22:00:11
湖南龙山一小区车库被淹,4 名业主移车失联其中 3 人遇难,有何警示意义?遇到暴雨有哪些注意事项?...

Leave Your Message