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

Translate components of method dispatch to Python argument names? #545

Closed
HalfWhitt opened this issue Nov 26, 2024 · 1 comment
Closed
Labels
enhancement New features, or improvements to existing features.

Comments

@HalfWhitt
Copy link

What is the problem or limitation you are having?

Objective C methods names can end up being really long, for example this calling of NSCosntraint's init:

self.native.addConstraint(
    NSLayoutConstraint.constraintWithItem_attribute_relatedBy_toItem_attribute_multiplier_constant_(
        self.native,
        NSLayoutAttributeTop,
        NSLayoutRelationEqual,
        self.native_stepper,
        NSLayoutAttributeTop,
        1.0,
        0,
    )
)

Describe the solution you'd like

My quite possibly naïve impression is that this would be much more legible if it were possible to call it like:

self.native.addConstraint(
    NSLayoutConstraint.constraintWith(
        item=self.native,
        attribute=NSLayoutAttributeTop,
        relatedBy=NSLayoutRelationEqual,
        toItem=self.native_stepper,
        attribute=NSLayoutAttributeTop,
        multiplier=1.0,
        constant=0,
    )
)

...Perhaps even accept snake_case too, if that wouldn't be a bridge too far (pun intended).

I would usually prefer to come up with at least a proof of concept to propose, but considering how unfamiliar I am with Rubicon and Objective C generally, I wanted to check first if this would even be desirable (and seem possible) in the first place before going down any rabbit holes.

Describe alternatives you've considered

A handful of # noqa in beeware/toga#2993 and some uncomfortably long lines aren't the end of the world.

Additional context

Just noticed this while looking at the aforementioned PR.

@HalfWhitt HalfWhitt added the enhancement New features, or improvements to existing features. label Nov 26, 2024
@HalfWhitt
Copy link
Author

HalfWhitt commented Nov 26, 2024

Wow. I had even seen #148 mentioned on beeware/toga#2975, but not clicked through and realized the full context. Please ignore.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New features, or improvements to existing features.
Projects
None yet
Development

No branches or pull requests

1 participant