fulcrologic / guardrails

Efficient, hassle-free function call validation with a concise inline syntax for clojure.spec and Malli
Eclipse Public License 2.0
237 stars 25 forks source link

another form of checking for prod builds #16

Closed mpenet closed 3 years ago

mpenet commented 3 years ago

Hi,

Could there be another form of >defn that will behave like the current one but still trigger the same validation as the regular version in production builds? In a lot of cases you want to remove them all, for this guardrails works fine, but it would be handy if the same syntax could also be used to annotate critical functions that will remain in the final build (I want to avoid instrument and potential gen it triggers).

Or maybe I am missing something obvious and this already exists in another form?

awkay commented 3 years ago

So, I really don't recommend leaving this on in production. You can of course turn off exceptions with the :throw? option, but spec validation can be really slow, and can really hurt runtime performance. We're actually working on a commercial product that analyzes your GR-annotated code to see if it can find problems statically. I hope to release that for beta testers in the next month or two.