defined?(@ivar) on the non main Ractor has two issues:
raising an exception
classC@iv1=[]defself.defined_iv1=defined?(@iv1)endRactor.new{pC.defined_iv1#=> can not get unshareable values from instance variables of classes/modules from non-main Ractors (Ractor::IsolationError)}.take
-> Do not raise an exception but return "instance-variable" because it is defined.
returning "instance-variable" if there is not defined.
class C # @iv2 is not defined def self.defined_iv2 = defined?(@iv2) end Ractor.new{ p C.defined_iv2 #=> "instance-variable" }.take
fix
defined?(@ivar)with Ractorsdefined?(@ivar)on the non main Ractor has two issues:-> Do not raise an exception but return
"instance-variable"becauseit is defined.
"instance-variable"if there is not defined.-> returns
nil