How to call a shadowed function

On the way of making a package CUDA.jl-compatible, the easiest way to get the Base.display function working without causing trouble, would be to enable @CUDA.allowscalar for just this function. So I thought to simply define it with this property and then hand over the task to the standard implementation. Yet then I did not know how to do this. Does anyone know how to call the shadowed function definition? I was hoping for something like

@CUDA.allowscalar display(arg::myType) = parentscope.display(arg)

You call invoke.

However, you should generally not overload display to do custom pretty printing. Instead, overload show as explained in the manual

1 Like

Thanks a lot for the help with invoke and hint on show. It took me a while to find the right (3-argument !) form, such that display hooks into it, which is why I post it here:

function Base.show(io::IO, mm::MIME"text/plain", cs::CircShiftedArray) 
    CUDA.@allowscalar invoke(Base.show, Tuple{IO, typeof(mm), AbstractArray}, io, mm, cs) 
end