(defn basic-validate-ns-spec [env macros? spec]
(when-not (or (symbol? spec) (string? spec) (sequential? spec))
(throw
(error env
(parse-ns-error-msg spec
"Only [lib.ns & options] and lib.ns specs supported in :require / :require-macros"))))
(when (sequential? spec)
(when-not (or (symbol? (first spec)) (string? (first spec)))
(throw
(error env
(parse-ns-error-msg spec
"Library name must be specified as a symbol in :require / :require-macros"))))
(when-not (odd? (count spec))
(throw
(error env
(parse-ns-error-msg spec
"Only :as alias, :refer (names) and :rename {from to} options supported in :require"))))
(when-not (every? #{:as :refer :rename} (map first (partition 2 (next spec))))
(throw
(error env
(parse-ns-error-msg spec
"Only :as, :refer and :rename options supported in :require / :require-macros"))))
(when-not (let [fs (frequencies (next spec))]
(and (<= (fs :as 0) 1)
(<= (fs :refer 0) 1)))
(throw
(error env
(parse-ns-error-msg spec
"Each of :as and :refer options may only be specified once in :require / :require-macros"))))))