I'm already dealing with this in another way on my side
This works for me: (extend-type UUID Object (toJSON [this] (str this)))
Do you think it would be bad to add a toJSON on UUID type in core.cljs?
https://github.com/clojure/clojurescript/blob/master/src/main/cljs/cljs/core.cljs#L11783
Can't we test this in the "coal mine" or something like?
what would toUUID do?
during JSON.stringify, if toJSON method exists, it will be called instead of "toString"
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify
It's totally fine to do it in your own app. Totally not fine to do it in a library or anywhere else where people don't have control over it.
> during JSON.stringify, if toUUID method exists, it will be called instead of "toString"
Are you sure?.. That page does not mention toUUID.
I know 🙂
But I'm asking, why not do this in the core?
current behavior is clearly not the ideal.
I still don't rule out the possibility of doing this in clj->js
ooops
s/toUUID/toJSON/g
Well, as David has said - doing that now is probably a bad idea. It's a breaking change. And not an unlikely one given that it's not a random internal thing but a public method that's expected to be overridden.