-
Notifications
You must be signed in to change notification settings - Fork 358
Closed
Description
Feature Request
Add Generics Support Fory Go, this will bring many benefits:
- avoid
interfacebox cost - type-safe API
- Fast path for generic types: we can create a serializer for every generic container such as
slice/map/array, and in all those serializer, we can avoid lots of type dispatch cost
Is your feature request related to a problem? Please describe
The current Go serialization API uses interface{} parameters which causes:
- Unnecessary heap allocations when passing values
- Extra struct copies for large objects
- Type safety issues at compile time
- Inconsistent API design compared to other languages
Describe the solution you'd like
Redesign the API to use:
- Generic functions
Serialize[T]andDeserialize[T]for type safety - Pointer-based parameters to avoid copies and allocations
- Separate
SerializeAnyandDeserializeAnyfor polymorphic use cases - Clean separation between typed and untyped APIs
Benefits
- Better performance by eliminating unnecessary allocations
- Compile-time type safety
- More idiomatic Go API design
- Clearer distinction between static and dynamic typing use cases
Describe alternatives you've considered
No response
Additional context
Metadata
Metadata
Assignees
Labels
No labels