Skip to content
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

Common - Cleanup DEFAULT_PARAM, _this #1706

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

BrettMayson
Copy link
Contributor

@BrettMayson BrettMayson commented Oct 19, 2024

Ref BrettMayson/HEMTT#804

When merged this pull request will:

  • Don't use DEFAULT_PARAM
  • Use different variables for _this
  • Rename the test for DEFAULT_PARAM to prevent HEMTT from yelling about it

@PabstMirror PabstMirror added this to the 3.18.2 milestone Oct 19, 2024
@BrettMayson BrettMayson changed the title don't use DEFAULT_PARAM, use different name for _this Common - Cleanup DEFAULT_PARAM, _this Oct 19, 2024
@PabstMirror
Copy link
Contributor

from discord

commy2 — 10/19/2024 7:16 AM
In general, using _this has the benefit that it is shadowed inside the called function, whereas introducing a local variable makes it bleed into the new scope.
There is a reason why _this is used. I don't like this part of the PR (no pun intended).
e.g, there is a reason it's named _CBA_code and not just _code.

I'm not worried about most of these changes, except for xeh and direct call.
A counter example I can come up with is

[] spawn {
    private _args = ["A"]; // user code
    sleep 0.1;
    [{  
        _args pushBack 77;
    }, _this] call CBA_fnc_directCall;
    x3 = _args; // just ["A"], expecting ["A",77]
};

changing to _CBA_args seems to fix

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants