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

Shorter constructor names #80

Merged
merged 5 commits into from
Nov 10, 2023
Merged

Shorter constructor names #80

merged 5 commits into from
Nov 10, 2023

Conversation

jwharm
Copy link
Owner

@jwharm jwharm commented Nov 10, 2023

Named constructors in GObject classes conventionally start with new_. This prefix is superfluous in the Java language bindings. For example, Button.newWithLabel() can more concisely be written as Button.withLabel(). Therefore, the Java-GI bindings has been changed to strip the new prefix from the name of the static factory methods for named constructors.

This is not a brand new idea; Gtk-rs also has this in a number of cases (including Button.with_label()).

@jwharm jwharm merged commit 066c16e into main Nov 10, 2023
@jwharm jwharm deleted the constructor-names branch November 10, 2023 21:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant