Faulty code: add permitUndeclared#13280
Merged
MarcusDenker merged 3 commits intopharo-project:Pharo12from Apr 5, 2023
Merged
Conversation
Contributor
Author
|
Tests passes, except windows (as usual) and unrelated issue #13281 |
MarcusDenker
approved these changes
Apr 5, 2023
This was referenced Apr 5, 2023
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This PR is based on #13277 (6 first commits).(was merged)Currently, the static status of undeclared variables is not great. Basically, they are statically accepted unless some heuristics in the compiler decided that you are in an interactive text editor or something, and you get a GUI menu instead.
The lack of a precise specification of the Pharo language cause confusion for users (or at least for myself).
Unfortunately, recent experiments (#13172 then #13244) showed that some important parts of Pharo rely on variables statically undeclared (with the hope that they will be repaired later), including CodeImport, Monticello and Traits.
Therefore, currently, forbidding globally the static use of undeclared variable seems very hard.
So, I would like to try another (easier) approach: do not let the compiler decide with some uncontrollable heuristic but make it an explicit parameter:
permitUndeclared.The PR defines the infrastructure for it, and sets up a default value that is (I hope) sufficiently compatible with the current policy. Now the heuristic is at a single place, at least :)
Future PR will then be able to update clients to use a better explicit value and drop the heuristic to use a sane static default value. I would like that
permitUndeclaredbe false by default unless specific tool require it to be true, but we'll see.Note: I initially wanted
permitFaultyto play the role ofpermitUndeclared, but this was complex to have without breaking too many things (mostly tests), and possibly introducing unexpected side effects and complex bug.So maybe in the long run
permitUndeclaredwill be merged withpermitFaulty, but I do not know yet.