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

2025-06-22 00:50: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要标新立异用中括号?
广告位810*200
相关阅读
女生真正的完美身材是什么样子?

女生真正的完美身材是什么样子?

最近在想,女生所谓的“完美身材”到底是什么。 我以前以...

2025-06-27
遭遇生理性涨奶该怎么办?

遭遇生理性涨奶该怎么办?

我的案例:我们在产后第三天开始生理性胀奶。 摸起来整个乳房都...

2025-06-27
为什么一部分 Go 布道师的博客不更新了?

为什么一部分 Go 布道师的博客不更新了?

哈哈,首先我不是布道师,算是 go 语言的爱好者吧。 😄 自...

2025-06-27
前端js如何处理数据持久化的问题?indexDB? localstore(有大小限制)?考虑离线情况?

前端js如何处理数据持久化的问题?indexDB? localstore(有大小限制)?考虑离线情况?

用Web Cache API。 虽然caches的设计目的...

2025-06-27
Centos为什么突然没人用了?

Centos为什么突然没人用了?

因为Centos把自己作死了呀。 转一个自己5年前写的回答...

2025-06-27