On Tuesday, November 14, 2017 at 4:16:00 PM UTC-6, Russell Mull wrote:
>
>
> This appears to be happening because the lazy sequence is actually 
> realized *by* spec when instrumentation is on, but at that point checking 
> is actually disabled with the st/with-instrument-disabled macro.
>
> A few questions:
>
> * Is this the intended behavior?
> * The code in question has been there as far back as I can trace it in 
> git. What is this check trying to guard against?
> * Does the fact that I got into this situation indicate that I'm doing 
> something wrong? (The above code is clearly contrived, but I did run into 
> this in a real program)
>

Hey Russell, this is a good repro and a good question. The intent here is 
to turn off instrumentation while doing the args conform, then re-enable it 
when the function is actually invoked so that you don't end up in a 
scenario where you are recursing through endless instrumentation frames 
(for cases where a spec uses functions that are also instrumented).

Certainly, the laziness of the input coll is the confounding factor here. 
One option is to use the non-conforming s/every instead of the conforming 
s/coll-of:

    (s/fdef print-coll-with-banner
       :args (s/cat :banner string? :xs (s/every any?)))

You'll find with this change that things work as you expect. 

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