4 ms·
So it's intentional to make people pass down raw strings versus making the communication safe(er) by default?
by frde_me 7mo ago
So it's intentional to make people pass down raw strings versus making the communication safe(er) by default?
- Manishearth 7mo ago.... we're talking about serialization here. "convert to a raw string" is sort of the name of the game. It's a string in a well specified string format. That's typically what you want for serialization. Temporal is typed; but its serialization helpers aren't, because there's no single way to talk about types across serialization. That's functionality a serialization library may choose to provide, but can't really be designed into the language.
- Hasnep 7mo agoThere are no date, time or datetime types in JSON, so you'll have to serialise it to a string or an int anyway, and then when deserialising you'll need to identify explicitly which values should be parsed as dates.
- zelphirkalt 7mo agoWell, you could still have a compound object in JSON, that is output by the Temporal API, and which given as input is guaranteed to result in an equal object it was created/serialized from. This compound object must contain all required infos about timezones and such stuff.
- deleted 7mo ago[deleted]
- jitl 7mo agoits gotta become bytes somehow
- hdjrudni 7mo agoYou realize that JSON isn't just for JavaScript to JavaScript communication, right? Even if you had a magical format (which doesn't make sense and is a bad idea to attempt to auto-deserialize), it wouldn't work across languages. If you really want that, it's not very hard to design a pair of functions `mySerialize()`, `myDeserialize()` that's a thin wrapper over `JSON.parse`.