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

Rework data binding to use generic types #5378

Open
2 tasks done
Jacalz opened this issue Jan 8, 2025 · 2 comments
Open
2 tasks done

Rework data binding to use generic types #5378

Jacalz opened this issue Jan 8, 2025 · 2 comments
Labels
Data binding Issue related to bug or improvement of data binding refactor Issues related to refactoring code.

Comments

@Jacalz
Copy link
Member

Jacalz commented Jan 8, 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?

With #5377 landed, there is only the code generation for data binding left. As there is quite a lot of code duplication between the binding types, this would be a wise place to apply generics and decrease our reliance on code generation. This should improve developer ergonomics and make the code easier to understand.

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

I think so. It might be possible to rewrite some internal types to use generics without impacting the public API but I think a nice change for v3.0.0 further down the line would be to have a public generic API for bindings (far into the future but anyway).

Describe the solution you'd like to see.

Clean up data binding using generics to try and remove code generation as much as possible.

@Jacalz Jacalz added enhancement New feature or request refactor Issues related to refactoring code. Data binding Issue related to bug or improvement of data binding and removed enhancement New feature or request labels Jan 8, 2025
@andydotxyz
Copy link
Member

We need to pay attention to the possible need for comparators as well - the custom types in tree/list need to be able to do change detection which we are falling short on at the moment.

@Jacalz
Copy link
Member Author

Jacalz commented Jan 12, 2025

Indeed. The cmp package may be useful for that: https://pkg.go.dev/cmp

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 refactor Issues related to refactoring code.
Projects
None yet
Development

No branches or pull requests

2 participants