(defn update-alias-meta [old-name old-meta]
(update old-meta :doc #(str "Alias for " old-name "." (if % "\n\n") %)))))
(defmacro defalias [new-name old-name]
(update-alias-meta '~old-name (meta (var ~old-name)))))
(defmacro defaliases [& syms]
(fn [[new-name old-name]]
`(defalias ~new-name ~old-name))
(partition 2 syms))))
(defalias plus +)
( [x] [x y] [x y & more])
Alias for +.
Returns the sum of nums. (+) returns 0. Does not auto-promote
longs, will throw on overflow. See also: +'
I don’t recommend abusing these. I find it very useful to be able to just look at a namespace form or a function and know what it depends on, and aliases make that more difficult.
I don’t think I’m actually using these in any of my code. I originally wrote them when I was using CouchDB and was making a library to provide more functionality than clutch, but I didn’t want to have to require both my library and clutch in every namespace (and remember which function belongs to which). Other than that, I have never found the loss of clarity to be worth saving a few lines of typing.