# Accidental overwrite base function name

**URL:** <https://discourse.julialang.org/t/accidental-overwrite-base-function-name/33080>\
**Category:** General Usage\
**Created:** [January 8, 2020, 1:03am UTC](https://discourse.julialang.org/t/accidental-overwrite-base-function-name/33080 "2020-01-08T01:03:12Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Egwene\_al\_Vere](https://avatars.discourse-cdn.com/v4/letter/e/df788c/32.png) [@Egwene\_al\_Vere](https://discourse.julialang.org/u/Egwene_al_Vere)\
**Post date:** [January 8, 2020, 1:03am UTC](https://discourse.julialang.org/t/accidental-overwrite-base-function-name/33080/1 "2020-01-08T01:03:12Z")

</div>

Not sure if it’s a bug or expected behavior: people may not know all the names of the built-in functions, and on a fresh start, the built-in function may be overwritten: on a fresh start, things like

```julia
diff = 0

```

would run without warning, and the function `diff()` will be over-written. On the other hand, if the function `diff()` has already been used, or one has used the help `?diff` then the assignment `diff = 0` would error; guess it’s fine if the function is overwritten if it’s never used, and if another module uses such function it’s also not affected:

```julia
module test
       function g(x)
              diff(x)*im
       end
end

@code_lowered test.g(rand(3))

```

shows

```julia
CodeInfo(
1 ─ %1 = Main.test.diff(x)
│ %2 = %1 * Main.test.im
└── return %2
)

```

Should julia always print error message when over-writing functions in stdlib regardless of whether it’s been used or is the current behavior fine as is? Thanks!

---

<div class="post-metadata">

**Author:** ![yuyichao](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/yuyichao/32/20_2.png) [@yuyichao](https://discourse.julialang.org/u/yuyichao)\
**Post date:** [January 8, 2020, 2:02am UTC](https://discourse.julialang.org/t/accidental-overwrite-base-function-name/33080/2 "2020-01-08T02:02:49Z")

</div>

The current behavior is intended. Otherwise adding new names to base would be hugely breaking.

---

<div class="post-metadata">

**Author:** ![Egwene\_al\_Vere](https://avatars.discourse-cdn.com/v4/letter/e/df788c/32.png) [@Egwene\_al\_Vere](https://discourse.julialang.org/u/Egwene_al_Vere)\
**Post date:** [January 8, 2020, 2:04am UTC](https://discourse.julialang.org/t/accidental-overwrite-base-function-name/33080/3 "2020-01-08T02:04:16Z")

</div>

makes sense, thanks!
