Redefining structs without restart?

That is the whole point. The language specification does not say what happens in in all cases when a const is redefined. Notice how Scope of Variables · The Julia Language says:

For instance, if a method references a constant and is already compiled before the constant is changed, then it might keep using the old value

You don’t get a guarantee what happens, the specification does not dictate it so it isn’t fixed. Undefined behaviour in most cases case is purely a semantic label, as running the same native code + same data + on same hardware + etc should always produce the same output as the processing is deterministic.

There’s plenty of APIs that only guarantee certain results for specific parameter values. Calling such an API with values outside of the guaranteed range might do one thing or the other, but you have no guarantee what will happen. And that is called undefined behaviour. Even though the actual code implementing the API is still deterministic and might not change for years, and so produce the same undefined behaviour given the same inputs, it can change at any point in time as no guarantee was given on what would be produced in the first place. And so should not be relied upon.

1 Like