That is correct, this is what I specifically mentioned when I brought this problem up, and this is also why I characterize it as an issue.
However, it is not impossible to think of a solution. Here is an example of how this could work
Base.unhinge_precedence(current_module())
Base.set_precedence(char, prec)
Perhaps, you could make it even simpler into a single function call
Base.set_precedence(current_module(), char, prec)
Essentially, you want the precedence to be context specific for whatever module you are currently in, to contain the changes. Then the parser can keep its current default precedence list, and if a specific module needs a different precedence, then you can simply create an Array
of precedence lists that maps to specific modules that had changes made. Then all you do is copy the default precedence list into the new one, except that the new one is mutable instead of immutable. Then you simply let the user change the precedence.
Thus, the parser then simply needs to have some basic logic to check if the precedence has been altered in a specific module, and if it has, branch off to select from the mutable Array
instead of the immutable default.
if module_precedence_modified
# pick from mutable array
else
# pick from immutable default
end
Fairly simple I think, and it doesn’t cause any breaking changes or compatibility issues.
If this is really so terrible for normal users and for the mainstream status of the language, please do elaborate and provide specific counter points, so that I can be convinced that this is a terrible idea. Right now, I am not convinced this is a bad idea, and I don’t think this would bother anyone, and if you don’t need it, then you would probably never notice that this features was added. If you need it, then win-win.