In my julia code I am using some constants. Some of these constants are strings (they serve as identifiers). My issues is that whenever I run a julia script, I always get the following warning for constant strings, even when I do not change the constants :
WARNING: redefining constant pot_type
To illustrate my problem, here is a MWE:
const pot_type = "constant"
const b = 12
println("Given parameters: Potential = $pot_type, b = $b .")
If I run this script two times, I will get the aforementioned warning.
Not only that, but the same thing will happen if I just type const something = "somestring"
two times in the Julia console. I just get WARNING: redefining constant something
.
I am aware that this does not affect my code in any way, but is there anyway to remove this warning or to fix it? In my actual code it creates 5 lines every time I submit something and this space could be used to display the output of previous submissions.
EDIT (making myself clearer): The problem is that this WARNING message is displayed even when I am NOT redefining a constant, meaning that I give it the same value. And also, this problem (as far as I know) exists ONLY for String
, not for Int64
or Float64
types. E.g.: if I write const b = 1.2
and then const b = 1.4
I will get the warning message as expected. Now, if I write const b = 1.2
and then const b = 1.2
(same value), I will NOT get the warning, again as expected. However this does not work with string constants. You will get the warning even when defining the same value.