You’re not wrong for identifying advantages of other languages’ features that are lacking or limited in Julia. That’s a large chunk of this forum. However, we have informed you why it is limited, and incorporating the sort of effect you’d like would sabotage the “fast and easy prototyping” you listed as a nice feature. Something that makes prototyping faster and easier is not having to throw away the entire session to replace and test a method signature. If you throw errors when a method is replaced, you would have to. There is no practical way of distinguishing when you’d like to throw that error and when you’d like the method replacement to go ahead; changing the name of the source file you include
does not matter to the global scope, and you had previously leveraged the ability to do that by renaming things _new.jl
. Even if a reasonable strategy is invented, it would be a breaking change and cannot be incorporated into v1 Julia.
I can’t say it’s easy, but plenty of languages have implemented errors. However, a language’s compiler can behave however the designers want. In fact, Julia’s compiler is not even involved when methods are defined, so it couldn’t possibly catch a redefinition and throw an error. The command for starting the Julia session provides an option for warnings, as demonstrated above, and you might also notice that it also occurs during package precompilation but goes on to trigger an error.