# Shadow Base name in REPL

**URL:** <https://discourse.julialang.org/t/shadow-base-name-in-repl/80719>\
**Category:** General Usage\
**Created:** [May 8, 2022, 7:50pm UTC](https://discourse.julialang.org/t/shadow-base-name-in-repl/80719 "2022-05-08T19:50:49Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![jar1](https://avatars.discourse-cdn.com/v4/letter/j/c0e974/32.png) [@jar1](https://discourse.julialang.org/u/jar1)\
**Post date:** [May 8, 2022, 7:50pm UTC](https://discourse.julialang.org/t/shadow-base-name-in-repl/80719/1 "2022-05-08T19:50:50Z")

</div>

Inspired by [How about to simplify the factorial function name? - #15 by cormullion](https://discourse.julialang.org/t/how-about-to-simplify-the-factorial-function-name/80715/15).

Say I want to define `!(x) = factorial(x)`. I can do that in a module

```julia
julia> baremodule M
       import Base
       !(x) = Base.factorial(x)
       Base.@show !5
       end
!5 = 120

```

but I can’t do it in the repl:

```julia
julia> !(x) = factorial(x)
ERROR: error in method definition: function Base.! must be explicitly imported to be extended

```

I don’t want to extend `Base.!`, so the advice it gives is not relevant. Is it possible to define `!` in the repl? Can I have a `bare` repl?

---

<div class="post-metadata">

**Author:** ![pfitzseb](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/pfitzseb/32/45566_2.png) [@pfitzseb](https://discourse.julialang.org/u/pfitzseb)\
**Post date:** [May 8, 2022, 8:16pm UTC](https://discourse.julialang.org/t/shadow-base-name-in-repl/80719/2 "2022-05-08T20:16:53Z")

</div>

That works just fine as long as you have not used `!` in that session before:

```julia
julia> !(x) = factorial(x)
! (generic function with 1 method)

julia> !(5)
120

```

The important thing is that bindings from Base (or any other module) are not resolved when you try to shadow them:

```julia
$ julia -q
julia> sin = 2
2

$ julia -q
julia> sin(2)
0.9092974268256817

julia> sin = 2
ERROR: cannot assign a value to variable Base.sin from module Main

```
