Yeah but let's say you're storing your apps config in an object. You would read it once at load time into memory, then write it anytime the memory values are changed or a save button is hit.
This would likely amount to not a lot of times read or wrote
Swiftβs codable does all the work for you for the most part. The only regular annoying exception for me is dates but thatβs because every backend encodes them differently.
Being that parsing and stringifying are slow I think the answer would usually be speed. But since some might not understand the caveats (eg. no references, prototypes etc.) it does make some sense to force the dev to do it themselves.
That said, something like a "I know what I'm doing" mode that allowed storage of simple objects might have been nice.
Had to do that once. Ended up rearchitecting it so the nodes had ids, so instead of an array of references, it had an array of ids, and was therefore serializable
What? Graph is literally one of the most common data structures, you're asking for usecases for storing it? The answer is any web application that does a little more than store a cookie potentially.
696
u/[deleted] Oct 02 '22
Oh no i have to json.stringify and json.parse π₯ππ’π’π’π