Skip to content
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

Marshalling Binary Symbols #107

Open
matthewh-BQ opened this issue Jul 27, 2020 · 1 comment
Open

Marshalling Binary Symbols #107

matthewh-BQ opened this issue Jul 27, 2020 · 1 comment

Comments

@matthewh-BQ
Copy link
Contributor

matthewh-BQ commented Jul 27, 2020

When marshalling symbols, e.g., $10, marshalling writes this out as a string. It should be writing this out as a symbol. Refer to: https://github.com/amzn/ion-go/blob/7c7b14b9dac9034d4831ffebbf4d4c54273b5447/ion/marshal.go#L172

There is encodeAs https://github.com/amzn/ion-go/blob/7c7b14b9dac9034d4831ffebbf4d4c54273b5447/ion/marshal.go#L129, but this seems to be a low level API.

Proposal would be for marshal to detect symbols and write it out as a symbol.

@fernomac
Copy link
Contributor

fernomac commented Jul 28, 2020

How do you know I didn't want to legitimately encode the string "$10"? It seems quite surprising if that secretly gets corrupted to whatever symbol happens to have ID 10. EncodeAs is not meant to be a low-level API, it's precisely for cases like this where you want to encode a value as a specific, non-default Ion type.

[edit: ahhh, low-level since it's EncodeAs not MarshalAs, I'm very likely an idiot. :) I'd be fine adding a MarshalAs function if it'd be useful for folks.]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants