For example:
julia> using Distributed
julia> r = RemoteChannel(()->Channel{Bool}(Inf))
RemoteChannel{Channel{Bool}}(1, 1, 1)
julia> @code_warntype take!(r)
Variables
#self#::Core.Compiler.Const(take!, false)
rr::RemoteChannel{Channel{Bool}}
args::Tuple{}
Body::Any
1 ─ %1 = Distributed.myid()::Int64
│ %2 = Core.tuple(Distributed.take_ref, rr, %1)::Core.Compiler.PartialStruct(Tuple{typeof(Distributed.take_ref),RemoteChannel{Channel{Bool}},Int64}, Any[Core.Compiler.Const(Distributed.take_ref, false), RemoteChannel{Channel{Bool}}, Int64])
│ %3 = Core._apply_iterate(Base.iterate, Distributed.call_on_owner, %2, args)::Any
└── return %3
I wonder if this type-instability is of concern in practical usage? In this case, for example, it’s known that the elements fetched from the RemoteChannel
will be of type Bool
.