Hacker News new | ask | show | jobs
by fendrak 2772 days ago
Indeed it can, but I believe the point is that it's not round-tripable, meaning you can't parse the resulting serialized JSON back into its original form, the one that contained the Date objects.

If you could do so, JSON.stringify/parse would be a convenient way to do a deep clone.

2 comments

Yeah that's right. All I'm saying is that no matter what, the following sentence is false:

> An example of a non-serializable value type is the Date object - it is printed in a non ISO-standard format and cannot be parsed back to its original value :(.

It would be cool if there was a webpage for “Is your function ______?” with a list of things that functions can be:

- Roundtrip-able (reversible?)

- Pure

- Effectful

- Mutation-doing

- Idempotent/Nullipotent

- Algebraically closed over the set of its inputs

- Et c.

Every time I hear about a new one I wish I had such a list

> - Roundtrip-able (reversible?)

You mean injective

> Roundtrip-able (reversible?)

Involution, if you mean calling a function twice will give the original input.