Thanks for bringing this up — it’s a very good point that the suggested deprecation simply won’t work in a @. deprecation. There are several alternatives, but they all have their downsides:
- You can protect the
Reffrom being dotted by using$Reflike was suggested above. This is a special syntax that just applies to the macro, though, so it’s not terribly intuitive. - You can also use a tuple literal like
@. f(x, (y,))to treatykind-of like a scalar. For most purposes this should be just as fast and scalar-like as aRef, but it’s not 100% scalar-like: ifxis scalar-like or a zero-dimensional array,f.(x, Ref(y))will return an unwrapped scalar, whereasf.(x, (y,))will return a 1-tuple. Some array types might also not support broadcasting with tuples as nicely as they do scalars.
The solution here, I think, will be a special syntax that will work everywhere to put values in a Ref. We’ve been talking about &y. That’s currently available and would make for a better alternative all around.