Share your thoughts in the 2025 State of Clojure Survey!

Welcome! Please see the About page for a little more info on how this works.

+1 vote
in ClojureScript by
edited by

Hello

derive's doc says:

Establishes a parent/child relationship between parent and
tag. Parent must be a namespace-qualified symbol or keyword and
child can be either a namespace-qualified symbol or keyword or a
class.

But in practice, ClojureScript accepts non-namespaced tag:

(derive :a ::b)
; nil
(isa? :a ::b)
; true

Clojure throws.

Is ClojureScript behavior expected or a bug?

Same question for the derive [h tag parent] form, which seems to accept non-namespaced keyword/symbol for both tag and parent, this time on both Clojure and ClojureScript:

(derive (make-hierarchy) :a :b)
; {:parents {:a #{:b}}, :ancestors {:a #{:b}}, :descendants {:b #{:a}}}

1 Answer

0 votes
ago by

Reading between the lines of this commit message, it seems like the intent was to relax the requirements on namespacing for private hierarchies (so, required for global but not for private).

Thus, I'm going to treat this as documentation issue in Clojure (presumably adding this constraint would break some existing code). Logged as https://clojure.atlassian.net/browse/CLJ-2934.

Not sure on CLJS.

...