/ go Public
proposal: encoding: BinaryMarshaler should be an append API #24630
Feedback is required from experts, contributors, and/or the community before a change can be made.
A language change or incompatible library change
The BinaryMarshaler API returns a freshly allocated byte slice. This makes it unadvisable to implement for high performance APIs, or even APIs that could happen to be used in high performance scenarios.
If it had an append-like API (
MarshalBinary(byte) (byte, error)) then also a lot of high performance and internal parsing operations could be BinaryMarshaler implementations, allowing more standard interface reuse.
The usability is not much worse, as
nilcan be passed to get the exact same behavior, and there's precedent in
The text was updated successfully, but these errors were encountered: