# Can a constant redefinition still raise a warning?

**URL:** <https://discourse.julialang.org/t/can-a-constant-redefinition-still-raise-a-warning/140431>\
**Category:** General Usage\
**Created:** [October 31, 2026, 4:02pm UTC](https://discourse.julialang.org/t/can-a-constant-redefinition-still-raise-a-warning/140431 "2026-10-31T16:02:13Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![pierre-haessig](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/pierre-haessig/32/217129_2.png) [@pierre-haessig](https://discourse.julialang.org/u/pierre-haessig)\
**Post date:** [October 31, 2026, 4:02pm UTC](https://discourse.julialang.org/t/can-a-constant-redefinition-still-raise-a-warning/140431/1 "2026-10-31T16:02:13Z")

</div>

Hello,

As I was navigating the [forum](https://discourse.julialang.org/t/redefining-constants-in-functions-confusing-behavior/27538/5) about constant redefinition, I noticed that, as per [1.12 release notes](https://docs.julialang.org/en/v1.12-dev/NEWS/):

> - Redefinition of constants is now well defined and follows world age semantics ([#57253](https://github.com/JuliaLang/julia/issues/57253)). Additional redefinitions (e.g. of types) are now allowed. See [the new manual chapter on world age](https://docs.julialang.org/en/v1/manual/worldage/).

And indeed, at least in the interactive command line (REPL) of Julia 1.13, the following session “just works” (no warning):

```julia-repl
julia> const a=1
1

julia> const a=2
2

```

Still, reading through the docstring of the [const](https://docs.julialang.org/en/v1/base/base/#const) keyword, it states at the end:

> In **some cases** _[bold format is mine]_ changing the value of a const variable gives a warning instead of an error. However, this can produce unpredictable behavior or corrupt the state of your program, and so should be avoided. This feature is intended only for convenience during interactive use.

So my question is: _which are these “some cases” where redefining a const gives a warning?_

Or is this text an 📜historical trace​📜 of the “pre Julia 1.12 era”?

---

<div class="post-metadata">

**Author:** ![technocrat](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/technocrat/32/220947_2.png) [@technocrat](https://discourse.julialang.org/u/technocrat)\
**Post date:** [October 31, 2026, 6:49pm UTC](https://discourse.julialang.org/t/can-a-constant-redefinition-still-raise-a-warning/140431/2 "2026-10-31T18:49:33Z")

</div>

So now a constant is a variable whose value is not initially expected to change, so that when you’re writing a module you get to worry about the side effects of modifying a constant in one routine mean you have to keep track of where it messes up another? I suppose it makes sense in terms of the traditional advice to avoid “magic numbers,” but I think it’s going to mess with peoples’ heads.
