-
Notifications
You must be signed in to change notification settings - Fork 17.9k
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
encoding/asn1: inconsistent APIs #1133
Labels
Comments
Gobs can't implement marshal and unmarshal in the raw the way JSON and ASN1 can because, unlike JSON and ASN1, there is type information stored in the data. It's a stream protocol, not a packet protocol. There could be a variant that always includes the type information but that would be wasteful and could lead to bad programming. |
Rob points out that gob only makes sense in stream mode. Json has a stream mode that matches the gob one exactly (read the docs for Encoder and Decoder in those packages). ASN.1 is not general enough to expend effort on things like streams. It's such an awful format. The only reason anyone takes it seriously is you have to use it to decode SSL certificates, and that's all the package is intended for. JSON and ASN.1 are different too: ASN.1 is good at binary blobs of data while that's arguably JSON's one weakness. Even so, I think you're right that it would be good to use the same signature for Marshal and Unmarshal in both, if only to set a good precedent for future packages. I'll update package asn1. Owner changed to r...@golang.org. Status changed to Started. |
This issue was closed by revision 8206baf. Status changed to Fixed. |
This issue was closed.
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
by jan.newmarch:
The text was updated successfully, but these errors were encountered: