Fork me on GitHub

I'm trying to figure out how to prevent my recursive spec-based generators from StackOverflowing. From what I can tell the checks that are built in based on *recursion-limit* are moot as soon as you use with-gen.

Vincent Cantin13:06:06

That’s really a coincidence, because I am currently working days and days on overcoming this problem.

Vincent Cantin13:06:30

You might want to give Minimallist a try.

Vincent Cantin13:06:06

@U07FP7QJ0 let me know if you want to try the pre-release repo.


what's your sales pitch? why should I consider Minimalist over Malli (my preferred solution nowadays), and does it solve the problem I linked to?


I currently have two places where I'm using with-gen that cause recursion,


The second one I could get away without the custom generator, it'll just do some extra work until it finds a valid value, but the first one is annoying. The spec boils down to (s/and (s/cat ...) vector?), but (s/cat ...) never generates vectors so when generating this tries 100 times and gives up


maybe there's a better way to write that? can I use regex specs but still convey that I really only want to match/generate vectors?

Alex Miller (Clojure team)14:05:24

Not easily (this is something we’ve added in spec 2)


Hello! I've recently done some reading on clojure spec and have added it to some side projects of mine, but I'm a little lost on how/when to use instrumentation (or orchestra). I've spec'd multiple functions in my project, but realize those are useless (aside from readability) without running some sort of instrumentation. Are there any resources explaining how to integrate instrumentation in a clojure project? I don't want to permanently leave a call to instrument inside my clojure files, and only want them to really be run during development phase. Aside from just running instrumentation in the REPL during the dev process, are there any best practices for instrumenting in my project? Thanks 🙂

Alex Miller (Clojure team)16:05:57

most useful in dev at the repl

Alex Miller (Clojure team)16:05:07

but could also be useful to turn on/off in a fixture around tests


Thanks! I've only ever used instrumentation in tests or the repl, but was thinking I was missing something. Back to the specs I go 🏃


@UB4EZH42F In the tests for seancorfield/next-jdbc I turn on instrumentation as part of test setup in several of the test namespaces.

👍 4

will check out the repo for examples - thanks!


I talk about how we use Spec at work in if that helps.