Replace untyped bindings with generic implementations #5502
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
Checklist
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.
The text was updated successfully, but these errors were encountered: