UUID

typesince v0.0-1424Edit
satisfies IComparable IEquiv IHash IPrintWithWriter IUUID

(UUID. uuid __hash)

Details:

A type representing a universally unique identifier (UUID).

Use uuid or #uuid literal to create one.


See Also:


Source code @ clojurescript:src/main/cljs/cljs/core.cljs
(deftype UUID [uuid ^:mutable __hash]
  IUUID

  Object
  (toString [_] uuid)
  (equiv [this other]
    (-equiv this other))

  IEquiv
  (-equiv [_ other]
    (and (implements? IUUID other) (identical? uuid (.-uuid other))))

  IPrintWithWriter
  (-pr-writer [_ writer _]
    (-write writer (str "#uuid \"" uuid "\"")))

  IHash
  (-hash [this]
    (when (nil? __hash)
      (set! __hash (hash uuid)))
    __hash)

  IComparable
  (-compare [this other]
    (if (instance? UUID other)
      (garray/defaultCompare uuid (.-uuid other))
      (throw (js/Error. (str "Cannot compare " this " to " other))))))