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

PrimitiveDecode and MetaData.PrimitiveDecode() should not be marked as deprecated. #404

Open
shizhx opened this issue Mar 18, 2024 · 2 comments
Labels

Comments

@shizhx
Copy link

shizhx commented Mar 18, 2024

This commit 4f8abaa marks both PrimitiveDecode and MetaData.PrimitiveDecode() as deprecated, but without these mechanisms, we would not be able to implement delayed parsing based on another field, which is the scenario described in #125. The Unmarshaler interface can't achieve the same effect because there's no type context.

To be honest, I think toml.Primitive is not as convenient as json.RawMessage because it requires holding the MetaData object for a long time.

@arp242
Copy link
Collaborator

arp242 commented Mar 21, 2024

To be honest I never quite understood the use case for either PrimitiveDecode() or json.RawMessage. I'll have a closer look at the issue you linked and look up some more about json.RawMessage as well, and see what to do about it.

Either way, it's not going away until a potential v2, which may never materialize. So no hurries.

@alexZaicev
Copy link

@shizhx is there any update on the issue? Right now there is no way to parse any field based on type that is quite a common use-case

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

No branches or pull requests

3 participants