binding partition: Start enforcing minimum world age for constant bin… #57102
+318
−164
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
…dings
Currently, even though the binding partition system is implemented, it is largely enabled. New
const
definitions get magically "backdated" to the first world age in which the binding was undefined.Additionally, they do not get their own world age and there is currently no
latestworld
marker afterconst
definitions. This PR changes this situation to give const markers their own world age with appropriatelatestworld
increments. Both of these are mandatory forconst
replacement to work.The other thing this PR does is to remove the automatic "backdating". To see the difference, consider:
Without an intervening world age increment, this will throw an UndefVarError on this PR. I believe this is the best option for two reasons:
Union{}
in the future (thus letting inference prune dead code faster).const
definitions to become active only after they are defined.To illustrate the second point, suppose we did keep the automatic backdating. Then we would have:
as opposed to on this PR:
The semantics are consistent, of course, but I am concerned that an automatic backdating will give users the wrong mental model about world age, since it "fixes itself" the first time, but if you Revise it, it will give an unexpected answer. I think this would encourage accidentally bad code patterns that only break under Revise (where they are hard to debug).
The counterpoint of course is that that not backdating is a more breaking choice. As with the rest of the 1.12-era world age semantics changes, I think taking a look at PkgEval will be helpful.