[#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@...
Issue #17326 has been reported by jez (Jake Zimmerman).
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:100841] [Ruby master Feature#17322] Deprecate `Random::DEFAULT` and introduce `Random.default()` method to provide Ractor-supported default random generator
From:
daniel@...42.com
Date:
2020-11-13 19:13:03 UTC
List:
ruby-core #100841
Issue #17322 has been updated by Dan0042 (Daniel DeLorme).
Eregon (Benoit Daloze) wrote in #note-6:
> I think `rand`, etc should use a thread-local Random instance (and thread-local implies Ractor-local, of course).
> Those thread-local Random instances should probably not be exposed to the Ruby level, so that way there is never a need to synchronize access to it.
Bypassing the need for synchronization is a very good idea.
> Is there any case where it's useful?
Good question. Found this. Doesn't look so useful.
faker-2.2.2/lib/faker.rb
35: @random || Random::DEFAULT
sentry-raven-2.11.1/lib/raven/configuration.rb
445: if Random::DEFAULT.rand >= sample_rate
That said, even though using Random::DEFAULT seems like an anti-pattern, there's no real benefit to removing it. Maybe just convert it to an instance not used by anything? (except gems/apps)
----------------------------------------
Feature #17322: Deprecate `Random::DEFAULT` and introduce `Random.default()` method to provide Ractor-supported default random generator
https://bugs.ruby-lang.org/issues/17322#change-88483
* Author: ko1 (Koichi Sasada)
* Status: Open
* Priority: Normal
----------------------------------------
`Random::DEFAULT` a default random generator used by `rand`, `srand`, `Array#shuffle` without a given random generator, and so on.
Random generators are not thread-safe, so they are not ractor safe, and they are not shareable.
So a program refer to `Random::DEFAULT` on non-main ractor, it causes an error.
To provide per-ractor default random generator, this ticket propose the `Random.default()` method which returns per-ractor random generator.
`Random::DEFAULT` is a result of `Random.default()` on main-ractor and it should be deprecated, or at least it should not be used on multi-ractor supporting apps and libraries.
--
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>