The following code used to work in Julia v0.6.4, but it is not working in Julia v1.0.
f(q::Q, x::Int) = q.x + x
# ERROR: MethodError: no method matching length(::Q)
What should I do to broadcast on
Q as a scalar?
Base.Broadcast.broadcastable(q::Q) = Ref(q)
What’s the reasoning for not having something like this as the default for new types?
Also, wrapping as a
Ref does not incur any performance costs?
Although it wouldn’t have helped in this special case, the advice is generally sound if you’re porting old code (older than 0.7) to 0.7/1.0.