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

Replace untyped bindings with generic implementations #5502

Open
2 tasks done
Jacalz opened this issue Feb 5, 2025 · 0 comments
Open
2 tasks done

Replace untyped bindings with generic implementations #5502

Jacalz opened this issue Feb 5, 2025 · 0 comments
Labels
data binding Issue related to bug or improvement of data binding enhancement New feature or request optimization Tickets that could help Fyne apps run faster

Comments

@Jacalz
Copy link
Member

Jacalz commented Feb 5, 2025

Checklist

  • I have searched the issue tracker for open issues that relate to the same feature, before opening a new one.
  • This issue only relates to a single feature. I will open new issues for any other features.

Is your feature request related to a problem?

We do currently have a couple untyped bindings that rely on runtime reflection to look up types and set their values appropriately. This reflection is slow, does not give the developer any type safety (which may lead to crashes or potential security issues popping up) and it might lead to larger binaries as the Go compiler needs to embed more type information that can be used at runtime. We should avoid runtime reflection to as large extent as we can.

It has been proven with #5378 that generics are a great fit for reducing code duplication within binding types. A generic implementation for bindings should be possible to use for this purpose.

Is it possible to construct a solution with the existing API?

Yes

Describe the solution you'd like to see.

I propose that we expose a generic binding that lets the compiler generate a type safe binding implementation for the specific type that the developer wants to use instead.

@Jacalz Jacalz added binding enhancement New feature or request optimization Tickets that could help Fyne apps run faster data binding Issue related to bug or improvement of data binding and removed binding labels Feb 5, 2025
@Jacalz Jacalz mentioned this issue Feb 5, 2025
4 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
data binding Issue related to bug or improvement of data binding enhancement New feature or request optimization Tickets that could help Fyne apps run faster
Projects
None yet
Development

No branches or pull requests

1 participant