Open vemv opened 5 years ago
standard-header would be a library similar (yet orthogonal) to how-to-ns.
Probably rewrite-clj is the best tool for the job, since one wants to preserve any metadata, comments, etc
It would ensure that certain clauses are always there, following user configuration.
Examples:
:refer-clojure :exclude [x y z]
:require [foo :refer [x y z]]
(flatten #{1 2 3})
defn
speced/defn
:require
:as
:refer
coll-of
refer
spec/def
[clojure.spec.alpha :as spec :refer [coll-of]]
standard-header would be a library similar (yet orthogonal) to how-to-ns.
Probably rewrite-clj is the best tool for the job, since one wants to preserve any metadata, comments, etc
It would ensure that certain clauses are always there, following user configuration.
Examples:
:refer-clojure :exclude [x y z]
is always there:require [foo :refer [x y z]]
is always thereUse cases
(flatten #{1 2 3})
is tremendously counterintuitivedefn
than tospeced/defn
defn
, even if no specing is there, and the day I want to add specing, the effort and diff will be minimal:require
,:as
and:refer
clauses for extremely used stuffcoll-of
should berefer
ed, it's a unique-enough name which looks ugly with a prefix (unlikespec/def
which is perfect)[clojure.spec.alpha :as spec :refer [coll-of]]
Considerations
:refer
s) should be able to whitelist standard-header's rules.