您好,欢迎光临陕西某某伟业体育文化传播有限公司网站!

新浪微博| 腾讯微博| 网站地图| 大部分语言都用尖括号<>表示泛型,为什么golang要标新立异用中括号?_河北省邢台市任泽区两替电子测量仪器有限公司
在线咨询热线:
0510-888888888
联系我们
服务热线
029-87375858
电话:15319958588
咨询微信:admin-2016
地址:西安市莲湖区西大街宏府安定广场58号楼5858室
当前位置:当前位置: 首页 >

大部分语言都用尖括号<>表示泛型,为什么golang要标新立异用中括号?
浏览: 发布日期:2025-06-20 21:40: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要标新立异用中括号?
全国服务热线:
029-87375858