You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Go 1.18 introduced generics. Generics allow for common patterns to be reused across types.
Today in packngo, we see duplication between ServiceOp types (devices and vlans, for example), effectively copy/pasting the Get, Delete, Update, List, and Create functions.
For some (if not all of these operations) we could create generic handlers that simplify how we onboard new endpoints.
This issue is academic in nature. The more pressing goal is a fully generated client per #215. Even in a generated client, generics could play a large role in avoiding duplication within generated code.
Go 1.18 introduced generics. Generics allow for common patterns to be reused across types.
Today in packngo, we see duplication between ServiceOp types (devices and vlans, for example), effectively copy/pasting the Get, Delete, Update, List, and Create functions.
For some (if not all of these operations) we could create generic handlers that simplify how we onboard new endpoints.
The following demonstrates this pattern: https://gotipplay.golang.org/p/LzqKaJ_aHoR (credit to @rogpeppe as discussed in Gopher's Slack)
This issue is academic in nature. The more pressing goal is a fully generated client per #215. Even in a generated client, generics could play a large role in avoiding duplication within generated code.
The text was updated successfully, but these errors were encountered: