Will Julia ever fix its "using ..." latency problems?

One possible outcome of undefined behavior include the code working as you would expect if the variable was not const. This is clearly intended for REPL use (the documentation says so). The basic idea is: instead of closing and opening the REPL again to redefine a const variable, I can try my luck and just redefine it to make a fast test I wanted to do; if it behaves as I expected this change to behave, then I had luck in my favor and this saved me a few seconds, if something else happens then I did not have luck on my side and will have to restart to adequately test what I wanted. Simple as that. It is a luck/chance/probability/bayesian thing. You have the possibility of play dice with the compiler and get some not-entirely-trustworthy information.

I am not sure if the possible changes in behavior are restricted to just to that one. I understand your point now, if this is the only possible behavior (i.e., the code may or may not act as any of the previous values was yet assigned to the variable) then you could infer more things and not worry about having your disk formatted, XD. It would be better to inquire someone from the Julia internals development about this. In particular, I am not sure if changing the const variable to an object of another type will always error, or it may accept it and end up with a segmentation fault when the variable is referenced, as the object address may not be inlined but the type information can be, for example.

3 Likes