On Thu, Dec 29, 2011 at 11:27 AM, vitalyper <vitaly...@yahoo.com> wrote:
> My question is why do we have BOTH :arglists metadata and usual fn
> args destructuring?

As Meikel surmised, it's to improve the docstring (shown by the doc
function). We (the CongoMongo team) have not been terribly consistent
about it tho' :(

In the command function you highlighted, we show defaults for keyword
arguments (and the implication is that it takes two arguments: cmd and
a map - which is not the case). In the mongo! function, we show
keyword argument defaults more in line with usage:

  {:arglists '([:db ? :host "localhost" :port 27017])}
  [& {:keys [db host port]
      :or {db nil host "localhost" port 27017}}]

In other functions, we just show the possible keyword arguments
without defaults:

;; create-collection!
  {:arglists
   '([collection :capped :size :max])}
  ([collection & {:keys [capped size max] :as options}]

;; fetch
  {:arglists
   '([collection :where :only :limit :skip :as :from :one? :count?
:sort :options])}
  [coll & {:keys [where only as from one? count? limit skip sort options]
           :or {where {} only [] as :clojure from :clojure
                one? false count? false limit 0 skip 0 sort nil options []}}]

Hopefully you can see the intent...
-- 
Sean A Corfield -- (904) 302-SEAN
An Architect's View -- http://corfield.org/
World Singles, LLC. -- http://worldsingles.com/

"Perfection is the enemy of the good."
-- Gustave Flaubert, French realist novelist (1821-1880)

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