Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

UUID handling code that is portable between Clojure and ClojureScript would be very useful.

ClojureScript has implemented a UUID type and provides the uuid and random-uuid functions to construct UUID's. Clojure doesn't have a native UUID type but would probably want to use java.util.UUID. Things to consider in implementing UUID support in Clojure directly, and how it would interoperate with ClojureScript:

  • construction
  • printing - print, pr, pretty print
  • reading
  • hash code
  • conversion to/from bits
  • conversion to/from string
  • extraction of components

UUID types

ClojureScript's only provides a generator for a random UUID (type 4). Another common (though less used) UUID type is a time based UUID (type 1). It is worth considering if we would want to add support for generating time based UUID's. In any case, a string/byte based constructor could construct time based UUID's from another source without needing to provide a generator directly.

Prior art

https://github.com/lbradstreet/cljs-uuid-utils

https://github.com/davesann/cljs-uuid