Description
Problem
The proposal in #55 got me thinking.
In Getty JSON, the implementation for the aggregate serialization interfaces (e.g., getty.ser.Seq
, getty.ser.Map
) has a field referencing the serializer passed to serializeSeq
, serializeStruct
, etc. I believe the field is used in every single one of the aggregate interface methods (no surprise there; most of them are literally called serializeX
).
But having to carry this field around in the implementation isn't ideal. Any SB that calls serializeSeq
already has a reference to the same serializer, so there's no need to store it in the implementation. Also, it makes more sense to have the serializer as a parameter of the methods doing the serialization than on the impl itself.
Proposal
So, what if we pass in the serializer to the methods like serializeElement
, serializeKey
, and so on? The SB calling serializeStruct
would always have a reference to the relevant serializer so it'd be easy to pass it in for them.
This would simplify implementations of the aggregate interfaces since they'd no longer need to keep a redundant serializer around.
Alternatives
No response
Additional Context
No response