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

0 votes
in Clojure by

Currently function clojure.core/load-libs treats '(a.namespace.name) as prefix list so this construct has no effect at all (as if it was prefix list without suffixes). At the same time '(link: a.namespace.name) causes require call (require 'a.namespace.name). In other cases functions require or use are ambivalent about differences between (link: ) and (). In this particular case there is difference between no-op and lib loading. E.g. Clojure validation tool Eastwood includes rule for this case since the behavior of (require '(a.namespace.name)) is not obvious.

The suggested change lets to avoid this special case in require or use calls (including ones that stem from ns macro expansion). Accepting both list and vector as library specification makes behavior uniform and similar to the way suffix items are handled in prefix lists.

The patch is minimal in order to avoid reordering sequential? functions in clojure/core.clj
Should I include tests for these cases also?

2 Answers

0 votes
by

Comment made by: petrglad

If on the other hand representing prefix lists as Clojure lists is intentional and list-for-prefix, vector-for-libspec-or-suffix should be distinguishing feature then we should issue error when
prefix list is enclosed in Clojure vector
libspec or suffix is in Clojure list

If backwards compatibility is important then one may at least write a warning in ':verbose' mode.

Also there should be error or warning if prefix list is empty.

0 votes
by
Reference: https://clojure.atlassian.net/browse/CLJ-1628 (reported by alex+import)
...