Skip to content

Faulty code: add permitUndeclared#13280

Merged
MarcusDenker merged 3 commits intopharo-project:Pharo12from
privat:faulty-code-permit-undeclared
Apr 5, 2023
Merged

Faulty code: add permitUndeclared#13280
MarcusDenker merged 3 commits intopharo-project:Pharo12from
privat:faulty-code-permit-undeclared

Conversation

@privat
Copy link
Contributor

@privat privat commented Apr 4, 2023

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 permitUndeclared be false by default unless specific tool require it to be true, but we'll see.

Note: I initially wanted permitFaulty to play the role of permitUndeclared, 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 permitUndeclared will be merged with permitFaulty, but I do not know yet.

@privat privat changed the base branch from Pharo12 to Pharo11 April 4, 2023 20:42
@privat privat changed the base branch from Pharo11 to Pharo12 April 4, 2023 20:42
@privat
Copy link
Contributor Author

privat commented Apr 4, 2023

Tests passes, except windows (as usual) and unrelated issue #13281

@privat privat changed the base branch from Pharo12 to Pharo11 April 5, 2023 09:35
@privat privat changed the base branch from Pharo11 to Pharo12 April 5, 2023 09:35
@MarcusDenker MarcusDenker merged commit dd205b9 into pharo-project:Pharo12 Apr 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants