Skip to content

Improve OCUndeclaredVariableWarning>>openMenuIn#12980

Merged
MarcusDenker merged 3 commits intopharo-project:Pharo12from
privat:oc-low-hanging-fruits-openMenuIn
Mar 16, 2023
Merged

Improve OCUndeclaredVariableWarning>>openMenuIn#12980
MarcusDenker merged 3 commits intopharo-project:Pharo12from
privat:oc-low-hanging-fruits-openMenuIn

Conversation

@privat
Copy link
Contributor

@privat privat commented Mar 13, 2023

Low-hanging fruit. A small cleanup of openMenuIn that reduces the hackish level a little

  • Remove overkill parameter
  • Move the menu to the only class that cares
  • Drop ugly dead hack (possibly related to some code removed a long time ago)

@Ducasse
Copy link
Member

Ducasse commented Mar 13, 2023

Jean the problem with using UI manager directly is that you are introducing a dependency to the UI part and the compiler should not depend on it. The current architecture really need a cleaning.
So we should check for now the Compiler could be configured to still open a menu but not via an explicit reference to UIManager.
Now this notion of openMenu from the compiler is totally horrible. People completely missed the point of layers.
This is the caller of the compiler that should try/catch.

@MarcusDenker
Copy link
Member

What I wanted to:

  • always compile Undeclared vars, like in non-interactive mode
  • Compile them in a way that they raise the exception at runtime (if in interactive development mode()
  • improve the tools to show a repair icon for Undeclared.

@estebanlm
Copy link
Member

please do not submit more enhancements until we open P12 development.
right now, we are just accepting bugfixes.

@privat
Copy link
Contributor Author

privat commented Mar 13, 2023

@Ducasse I agree, except that the PR does to add a new dependency, because it existed already before. What the PR does is moving the dependency in a single class (instead of spreading around 2½ classes).
The cover letter states "reduces the hackish level a little" because it is what it does.

Is the code still bad? Yes, but a little less.
If it's still bad, then why do we care? Because currently the state of the code is so bad (high coupling, low cohesion) that trying to improve stuff too broadly breaks a lot of things, and it's frustrating. But small, iterative and incremental changes helps to validate things in bite-size steps (both for CI and code review by humans).

My whole plan is to drastically sever the compiler<->UI relationship and simplify the whole API of the compiler, that includes all the crazy hacks and specific corner cases accumulated over time.

@MarcusDenker yes I agree, but that is not for short term because a lot of things are missing or breaking. I tried various kind of more radical approaches in some of my development branches (including nuke the whole thing), with non-conclusive results. Thus, the small proposed change here is a step towards the "nuke" result.

@estebanlm yes, see #12978 (comment)

@Ducasse Ducasse added this to the 12.0.0 milestone Mar 13, 2023
Copy link
Member

@MarcusDenker MarcusDenker left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good clean. The workaround for the RubSmalltalkCommentMode is good to remove, as this was a real ugly hack that might not be needed anymore

@privat
Copy link
Contributor Author

privat commented Mar 14, 2023

@estebanlm Maybe this PR might interest the Pharo11 branch since it fixes the error reporting when having undeclared variables in the class definition pane of calypso (see blogpost).
But if you think it's too intrusive, I will change the base to Pharo12
oops wrong PR (I have so much open 😭)

@privat privat changed the base branch from Pharo11 to Pharo12 March 14, 2023 13:55
@privat privat changed the base branch from Pharo12 to Pharo11 March 15, 2023 20:33
@privat privat changed the base branch from Pharo11 to Pharo12 March 15, 2023 20:34
@privat privat changed the base branch from Pharo12 to Pharo11 March 15, 2023 23:27
@privat privat changed the base branch from Pharo11 to Pharo12 March 15, 2023 23:27
@privat
Copy link
Contributor Author

privat commented Mar 16, 2023

Tests on Pharo12 ok, except a crash on windows. This feels unrelated

@MarcusDenker MarcusDenker merged commit 97af9b3 into pharo-project:Pharo12 Mar 16, 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.

4 participants