In the Hiccup library, some functions take an optional map of
attributes as their first argument.

So I could write:

  (text-field :name)
  (text-field :name "Bob")
  (text-field {:class "foo"} :name)
  (text-field {:class "foo"} :name "Bob")

The question is how best to represent this in the arglist metadata for
the function. On the #clojure IRC channel, Vinzent favours:

  (text-field attrs? name)
  (text-field attrs? name value)

But I was leaning toward:

  (text-field name)
  (text-field name value)
  (text-field attrs name)
  (text-field attrs name value)

The Clojure docs docs seem to favour the first style [1], but there's
an ambiguity as to whether "attrs?" means an optional argument or a
boolean value.

The second style has no ambiguity, but does mean that two arglists
have the same cardinality.

What do people on the group think? Which documentation style is
clearer? Is there another option we haven't tried yet?


[1]: http://clojure.github.com/clojure/clojure.core-api.html#clojure.core/defn

-- 
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