Fork me on GitHub
#clojurescript
<
2023-01-10
>
grav06:01:47

What's the reasoning behind cljs.core/uuid? It doesn't seem very meaningful, and there isn't one in Clojure core. Example:

#uuid"foo"
Invalid UUID string: foo

(uuid "foo")
=> #uuid"foo" ;; wth?

grav06:01:20

I know we have parse-uuid to keep our sanity, so maybe uuid should be deprecated?

thheller06:01:35

as with many things in clojure it is assumed that you provide the correct input

thheller06:01:14

if you want validation use parse-uuid

grav06:01:41

i'm just thinking of the poor newcomers ...

thheller06:01:52

maybe a docstring could clean up any confusion, but I don't see an issue with both of these existing.

👍 2
Rupert (All Street)08:01:05

I guess (uuid "foo") is similar to (keyword "this doesn't looks like a keyword"). and (symbol "doesn't seem like a symbol"). One possibility is (uuid "foo") gives forward compatibility with future uuid layouts/formats/sizes etc. As it's part of the core library and it's not actively doing harm. I don't see why it would get deprecated (as deprecation would creates unnecessary uncertainty for all the code/projects using it).