New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
"With inspections" #2995
Comments
Okay, I just thought of a legit use case for
That is, if the module is a document module, |
Semi-related, should there be a refactoring for inlining |
The main problem that I would see with inlining
In that case, the refactoring would need to introduce a local variable. The problem with that, is that
In-lining that requires an explicit |
The first case is trivially solved though; the |
FWIW, I cannot agree with the idea of replacing
In a more complex module, especially with module level variables, that can be easily missed and can lead to ambiguous name. I'd rather that people were trained to consistently |
With Me
I can't think of a single valid use case for
With Me
:Can be rewritten as:
With Me
hides the non-public members because it accesses the current instance from its public interface, which is inviting hybrid code referencing private members from the current instance, and public members from the current instance's public interface: that's certainly making the VBA runtime work much harder than it needs to, even with everything being early-bound.With UserForm1
This one is actually a bug waiting to happen:
If that's in the code-behind of
UserForm1
, then it's working against the form's default instance, which may or may not be the current instance, soWith Me
would be the intention... which means the code is better off as, again:That's applicable to any class with a default instance, not just forms.
The text was updated successfully, but these errors were encountered: