I'm puzzled by two :or syntaxes that are used in io.pedestal.service.http, 
from [io.pedestal/pedestal.service "0.1.1-SNAPSHOT"], which is where 
following along with the Getting Started got me.

In one place, it pairs :or with a map whose keys are symbols being bound in 
the outer form:

 {routes ::routes
    file-path ::file-path
    resource-path ::resource-path
    method-param-name ::method-param-name
    :or {file-path nil
         resource-path "public"
         method-param-name :_method}
    :as service-map}

A little farther down, it pairs :or with a map whose key is a key from the 
map being destructured:

  {servlet ::servlet
    type ::type
    :or {::type :jetty}
    :as service-map}

In a tiny experiment, I don't see the second way working.  But the compiler 
does not emit any message.  Is there something subtle going on?

helloworld.server=> (defn a [{x :X y :Y :or {y 3}}] (vector x y))
#'helloworld.server/a
helloworld.server=> (a {:X 7})
[7 3]
helloworld.server=> (defn a' [{x :X y :Y :or {:Y 3}}] (vector x y))
#'helloworld.server/a'
helloworld.server=> (a' {:X 7})
[7 nil]



-- 
-- 
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
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to