-
Notifications
You must be signed in to change notification settings - Fork 52
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
Contexts that can be serialized + deserialized while retaining and explicitly representing sharing #2202
Conversation
Not quite ready to merge --- still need to update more JSON instances --- but I would be happy to get any comments or questions at this point! I've tried to put in a bunch of comments but it's quite possible, even likely, that it's still confusing. Please let me know and I will happily add more comments or clarify anything that's confusing. |
Co-authored-by: Restyled.io <commits@restyled.io>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @byorgey, this enables debugging using the Web API again. 👍
I considered removing the context in JSON output entirely, so having only hashes is better than what I would have aimed for. 😄
Towards #2107. Instead of simply storing a
Map
, contexts now also store a structured tree representing how it was built, and cache homomorphic hash values so contexts can be compared + stored by hash. This allows us to serialize contexts into a compact form that never duplicates any context, then deserialize them in a way that restores all the sharing.The big thing that is left is to make
FromJSONE
instances forValue
andEnv
(and anything which contains them). I was working on these but got bogged down, so decided to not let the perfect be the enemy of the good. You can see some commented-out code towards aFromJSONE Value
instance. But we don't use any such instances yet, so I think this can be merged as is, and the rest worked out later.