Yes. Apparently you can put whatever garbage you want into the `:or` map:
each local is looked up in that map to see if it has a default, but nobody
ever checks to see if there are unused keys in the defaults map. So `:or
{::type :jety}` has no impact at all on the generated code: there is no
local named `::jetty` (of course, since that would be an illegal name for a
local).
On Tuesday, March 19, 2013 11:19:27 PM UTC-7, Sean Corfield wrote:
>
> Pretty sure it's just a typo / bug. I think it should read:
>
> {servlet ::servlet
> type ::type
> :or {type :jetty}
> :as service-map}
>
> On Tue, Mar 19, 2013 at 10:09 PM, Matching Socks
> <[email protected]<javascript:>>
> wrote:
> > 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 [email protected]<javascript:>
> > Note that posts from new members are moderated - please be patient with
> your
> > first post.
> > To unsubscribe from this group, send email to
> > [email protected] <javascript:>
> > 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 [email protected] <javascript:>.
> > For more options, visit https://groups.google.com/groups/opt_out.
> >
> >
>
>
>
> --
> 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 [email protected]
Note that posts from new members are moderated - please be patient with your
first post.
To unsubscribe from this group, send email to
[email protected]
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 [email protected].
For more options, visit https://groups.google.com/groups/opt_out.