Actions
Bug #18193
closedAccessing global configuration from Ractors
Description
Consider a very common Ruby code with attr_accessor
on a class:
class GlobalConfig
class << self
attr_accessor :option
end
end
GlobalConfig.option = 123
GlobalConfig.freeze
puts GlobalConfig.frozen? # => true
r = Ractor.new do
GlobalConfig.option
end
puts r.take
Right now, this fails can not access instance variables of classes/modules from non-main Ractors
.
Is this considered a bug? If it is, I'd be happy to work on a fix.
To me, it seems like we should allow accessing frozen objects.
If this is expected behavior, then I'd like to open a conversation for how libraries and apps should expose things like global configuration for Ractors to consume.
Actions
Like0
Like0Like0Like0