Can a constant redefinition still raise a warning?

Hello,

As I was navigating the forum about constant redefinition, I noticed that, as per 1.12 release notes:

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

julia> const a=1
1

julia> const a=2
2

Still, reading through the docstring of the 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 :scroll:historical trace​:scroll: of the “pre Julia 1.12 era”?

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.

I’m not an expert. But given the shortage of responses, I’ll provide my understanding. I’m doing my best to interpret The World Age mechanism · The Julia Language.

I believe this warning is a vestige that is no longer accurate.

When they say that const bindings are tied to world age, this means that changing a const will be correctly reflected in the next world age (see the example in the link, and explanation elsewhere on that page for when the world age advances). But you can count on that to happen correctly (or else it should be reported as a bug).

This also means that the price of changing a const variable is that it will usually force recompilation of any method instance that depends on it.