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

Generate builders #286

Closed
antoyo opened this issue Oct 15, 2016 · 2 comments

Comments

Projects
None yet
2 participants
@antoyo
Copy link
Member

commented Oct 15, 2016

Hello.
In GObject, it is possible to create an object with multiple construct properties with g_object_new.
I wonder if it would be nice to generate builders (using the builder pattern) for objects using their construct properties.
Here is a constructor that I wrote because it was impossible to use it correctly if I set these properties after creating the object.

I believe we could use the builder pattern so that we could construct this particular object as such:

let webview: WebView = WebViewBuilder::new()
    .context(context)
    .user_content_manager(content_manager)
    .build();

What do you think about this idea?
Do you have another idea?
Thanks.

@gkoz

This comment has been minimized.

Copy link
Member

commented Oct 30, 2016

It's a good idea but probably secondary to actually generating a struct corresponding to constructor properties.

@antoyo

This comment has been minimized.

Copy link
Member Author

commented May 14, 2019

Fixed by #757.

@antoyo antoyo closed this May 14, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.