From: "AMomchilov (Alexander Momchilov) via ruby-core" Date: 2023-06-03T03:07:30+00:00 Subject: [ruby-core:113747] [Ruby master Feature#18894] Object#make_shareable Issue #18894 has been updated by AMomchilov (Alexander Momchilov). `#make_shareable` sounds like it's an alias for `Ractor.make_shareable`. Callbacks tend to be past tense, how about `#made_shareable`? ---------------------------------------- Feature #18894: Object#make_shareable https://bugs.ruby-lang.org/issues/18894#change-103394 * Author: chucke (Tiago Cardoso) * Status: Open * Priority: Normal ---------------------------------------- I'm proposing a callback method for when one calls `Ractor.make_shareable(obj)`, the same way `Marshal.dump(obj)` calls `obj.marshal_dump`. A lot of use cases in the wild involve a quick initialization of an object, only for some more heavy initializattion to be lazily called the first time an operation is called. An example in stdlib is `Resolv::Hosts`, which calls `lazy_initialize` on certains calls to resolve a name. Given that `Resolv` has a default resolver, this is unusable in ractors, due this "lazy" thing. Having a callback would allow to eager-load such an object, thereby making the default resolver usable with ractors. -- https://bugs.ruby-lang.org/ ______________________________________________ ruby-core mailing list -- ruby-core@ml.ruby-lang.org To unsubscribe send an email to ruby-core-leave@ml.ruby-lang.org ruby-core info -- https://ml.ruby-lang.org/mailman3/postorius/lists/ruby-core.ml.ruby-lang.org/