You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Instead of generating toX and fromX as extensions directly, create a single getter like Person.codable.json and on that would be .codec, or perhaps that itself implements Codec which would allow you to do Person.codable.json.encode(person) and Person.codable.json.decode('{...}')
And you can always do Person.codable.json.fuse(utf8) which would let you work with raw bytes instead.
I think it has potential.
We could still have to/fromX as conveniences, and only use the code when we care to, but I think there's a benefit.
Activity
TekExplorer commentedon Feb 14, 2025
Perhaps it would require shifting the API a bit.
Instead of generating toX and fromX as extensions directly, create a single getter like
Person.codable.jsonand on that would be.codec, or perhaps that itself implements Codec which would allow you to doPerson.codable.json.encode(person)andPerson.codable.json.decode('{...}')And you can always do
Person.codable.json.fuse(utf8)which would let you work with raw bytes instead.I think it has potential.
We could still have to/fromX as conveniences, and only use the code when we care to, but I think there's a benefit.
schultek commentedon Feb 14, 2025
See #12
TekExplorer commentedon Feb 14, 2025
oh interesting