I use clojure.contrib.def/defvar a lot. It's really useful for adding
docstrings to non-function vars. But I've been tripped up by the same
mistake a lot now—I keep expecting the docstring to go after the
initial value, because that would be consistent with defn, defmacro,
and defmulti.

Here are the current forms of defvar:
       (defvar name)
       (defvar name init)
       (defvar name init doc-string)

Why can't they be like this:
       (defvar name)
       (defvar name init)
       (defvar name doc-string init)
These forms are possible from just arity overloading.

For bonus points, the form can be instead:
       (defvar name doc-string? attr-map? init)
though that would be above the call of duty.

The biggest reason why they shouldn't be rearranged that I can think
of is that people might make mistakes when defining a var with a doc-
string without any initial value, which isn't much of a reason
compared to consistency with the core API. While it's okay if it's not
possible to change clojure.contrib.def/defvar, I would love for it to
happen.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to