# How to call a shadowed function

**URL:** <https://discourse.julialang.org/t/how-to-call-a-shadowed-function/97547>\
**Category:** General Usage\
**Tags:** cuda, functions\
**Created:** [April 16, 2023, 2:29pm UTC](https://discourse.julialang.org/t/how-to-call-a-shadowed-function/97547 "2023-04-16T14:29:30Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![RainerHeintzmann](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rainerheintzmann/32/19726_2.png) [@RainerHeintzmann](https://discourse.julialang.org/u/RainerHeintzmann)\
**Post date:** [April 16, 2023, 2:29pm UTC](https://discourse.julialang.org/t/how-to-call-a-shadowed-function/97547/1 "2023-04-16T14:29:30Z")

</div>

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

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

```

---

<div class="post-metadata">

**Author:** ![stevengj](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/stevengj/32/71_2.png) [@stevengj](https://discourse.julialang.org/u/stevengj)\
**Post date:** [April 16, 2023, 3:01pm UTC](https://discourse.julialang.org/t/how-to-call-a-shadowed-function/97547/2 "2023-04-16T15:01:55Z")

</div>

You call `invoke`.

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

---

<div class="post-metadata">

**Author:** ![RainerHeintzmann](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rainerheintzmann/32/19726_2.png) [@RainerHeintzmann](https://discourse.julialang.org/u/RainerHeintzmann)\
**Post date:** [April 16, 2023, 4:05pm UTC](https://discourse.julialang.org/t/how-to-call-a-shadowed-function/97547/3 "2023-04-16T16:05:54Z")

</div>

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:

```julia
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

```
