> On Dec 30, 2016, at 9:42 AM, John Schmidt <john.schmid...@gmail.com> wrote:
> 
> (s/def ::game1 #(satisfies? Game %))
> (s/def ::game2 (partial satisfies? Game))
> 
> (s/explain ::game2 (spec-test.foo/->Foo))
> val: #spec_test.foo.Foo{} fails spec: :spec-test.core/game2 predicate: 
> (partial satisfies? Game) <---- WAAAAAT
> nil

It looks like the spec macros aren’t resolving the Game reference in the game2 
spec.  You can use macroexpand-1 to see what was happening at the top-level.  
The internal macros get a little complicated so I can’t say if code expressions 
like this were intended to work.  It doesn’t hurt to file a bug.

I think the usual way to write this would be to define your own little 
predicate first and then use that var in the spec.

(def my-game? (partial satisfies? Game))

(s/def ::game3 my-game?)

If you want to work around the immediate issue, try using the fully qualified 
symbol for the protocol.  (I prefer ::game3 FWIW.)

(s/def ::game4 (partial satisfies? spec-test.core/Game))






-- 
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/d/optout.

Reply via email to