-
Notifications
You must be signed in to change notification settings - Fork 9
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
DL duplicates data when using pointers to structs #152
Comments
From my PoV I'd appreciate it if they were separate json-objects serialized just like the actual data would look like in memory but as json instead. Then have the structs refer to them by index or something similar? I guess there should be a storage passed in the serialization context that handles all existing references to serialized objects to handle this? |
So all structs which someone points to will get a magic "__index" member which pointers can refer to? |
Something like that would make sense imo yes, I'm not sure what @wc-duck thinks tho? |
hmm... in that case we could just use any name, such as "__ref_id" or similar so that if you write it by hand you can just write something that makes sense. But also, this would only be needed if you reference an item that is also part of an array or struct right? Otherwise they are just put in Right? Long time since I worked with the pointers? :) |
Yes, that is right. I agree that writing something sensible when authoring it by hand is a great feature. And keeping pointer payloads which aren't used as arrays or members of structs is also fine, it is one correct way of doing it, and the closest to what is there today. For improved json readability I could also imagine it working by putting each pointer payload in the place where it is first referred to, and then all other pointers to it will just refer to the "__ref_id". But that is a matter of taste, both would work and option 1 is probably least work. |
F.Y.I: |
I've created a test for this in #151
I could try to solve it myself, but I'm not sure how to best put a tag on some data in JSON so a pointer can refer to it. Any opinions?
The text was updated successfully, but these errors were encountered: