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

[DISCUSSION] Automatic ensure_type() #1401

Closed
DaKnig opened this issue May 18, 2024 · 2 comments
Closed

[DISCUSSION] Automatic ensure_type() #1401

DaKnig opened this issue May 18, 2024 · 2 comments
Labels
enhancement New feature or request

Comments

@DaKnig
Copy link
Contributor

DaKnig commented May 18, 2024

look at this boilerplate. each type has to specify what other custom types it depends on, forming a kind of a tree that devs need to maintain. this leads to code duplication (I have this line at least 4 times), maybe we could solve this.
this is also confusing to beginners and adds extra burden...

proposed ideas:

  • maybe #[template_child] macro can check if the item has IsA<Object> and if so, ensure_type() on it automatically. is that possible? what would it take?
  • maybe have a list of type in some top level module (like window or application or whatever) with a list of all types we provide, then ensure_type them all whenever any type in the module is loaded?
  • other ideas?

we have most of the information to do it automatically. I think it should be done.

@DaKnig DaKnig added the enhancement New feature or request label May 18, 2024
@bilelmoussaoui
Copy link
Member

It is already called automatically for types that are used in TemplateChild

@DaKnig
Copy link
Contributor Author

DaKnig commented May 24, 2024

my bad! I was able to remove all but the last one! thanks!

@DaKnig DaKnig closed this as completed May 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants