gpt4 book ai didi

ruby - 为什么在 Ruby 3.0 中从标准库中删除了 SortedSet?

转载 作者:行者123 更新时间:2023-12-05 02:41:11 24 4
gpt4 key购买 nike

当我将我的应用程序切换到 Ruby3+ 版本时,这是一个非常令人惊讶的发现。

虽然是大版本升级但还是..

从已经存在至少 10 年(从 1.9.3 开始?)的标准库中删除核心数据类型 看起来很奇怪。

有什么我不知道的令人信服的理由吗?

它引发的错误:

"The SortedSet class has been extracted from the set library. You must use the sorted_set gem or other alternatives."

最佳答案

经过一番搜索,我发现了以下内容:

Remove SortedSet implementations PR

It required RBTree to perform decently and the external dependency was not suitable for a standard library. The pure ruby fallback implementation was originally meant to be a demonstration of how to write a subclass of Set, and its poor performance was not suitable for use in production.

I decided it should be distributed as an external library instead of bundling it with Set.


为了保持简短:

SortedSet has been removed for dependency and performance reasons.

source

关于ruby - 为什么在 Ruby 3.0 中从标准库中删除了 SortedSet?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/68208165/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com