[#100689] [Ruby master Feature#17303] Make webrick to bundled gems or remove from stdlib — hsbt@...
Issue #17303 has been reported by hsbt (Hiroshi SHIBATA).
11 messages
2020/11/02
[#100852] [Ruby master Feature#17326] Add Kernel#must! to the standard library — zimmerman.jake@...
SXNzdWUgIzE3MzI2IGhhcyBiZWVuIHJlcG9ydGVkIGJ5IGpleiAoSmFrZSBaaW1tZXJtYW4pLg0K
24 messages
2020/11/14
[#100930] [Ruby master Feature#17333] Enumerable#many? — masafumi.o1988@...
Issue #17333 has been reported by okuramasafumi (Masafumi OKURA).
10 messages
2020/11/18
[#101071] [Ruby master Feature#17342] Hash#fetch_set — hunter_spawn@...
Issue #17342 has been reported by MaxLap (Maxime Lapointe).
26 messages
2020/11/25
[ruby-core:101132] [Ruby master Feature#17351] Deprecate Random::DEFAULT
From:
eregontp@...
Date:
2020-11-27 15:05:25 UTC
List:
ruby-core #101132
Issue #17351 has been updated by Eregon (Benoit Daloze).
It seems pretty rare to need to supply a custom Random instance.
But in such a case, it would be easy to create an explicit one in e.g. the constructor:
```ruby
class Dice
def initialize(random = Random.new)
@random = random
end
def roll
@random.rand(6) + 1
end
end
```
If it needs to scale and run well with parallel threads, the built-in `Kernel#rand` is probably the only good option.
----------------------------------------
Feature #17351: Deprecate Random::DEFAULT
https://bugs.ruby-lang.org/issues/17351#change-88813
* Author: Eregon (Benoit Daloze)
* Status: Open
* Priority: Normal
* Assignee: matz (Yukihiro Matsumoto)
----------------------------------------
From https://bugs.ruby-lang.org/issues/17322#note-11
I think we should deprecate the `Random::DEFAULT` constant, it doesn't make sense anymore and it's longer than using Random class methods (Random.rand) or Kernel instance methods (#rand).
Also, people might expect it to be global.
If users want a Random instance they should just use `Random.new`, not assume there is a global instance in Random::DEFAULT, which is actually rather misleading now (Random::DEFAULT is no longer an instance of Random).
Also note that JRuby & TruffleRuby use a per-thread instance for Kernel#rand, etc, to avoid contention (otherwise it becomes a huge source of contention when threads run in parallel).
Which means on those implementations using Random::DEFAULT was inefficient (extra synchronization).
So for all these reasons I think it's time to deprecate `Random::DEFAULT` and then later remove it (in 3.1?).
I don't think there is any use case for `Random::DEFAULT`, but happy to hear if there is and there is no trivial replacement.
--
https://bugs.ruby-lang.org/
Unsubscribe: <mailto:ruby-core-request@ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>