(when (or config/is-dev? config/is-test?)
(defn load-stuff [] ,,,))
,,,
(defn init!
[]
,,,
(when (or config/is-dev? config/is-test?)
(load-stuff)))
just random, this works. Does it intentionally work and this is fine, or does this abuse the compiler a bit? When not dev load-stuff will be an unbound var. So it is unconditionally made but conditionally bound. I can’t tell if this is proper™ or notDoes it matter whether it's an unbound var in prod or a non-existent var? (when false (something-that-doesn't-exist-at-all)) works just fine.
The only scenario that I can see where things could go wrong is if you AOT that code with direct linking when somehow is-dev? or is-test? is true and run it in an environment where it's false.
it doesn’t matter that its unbound in the jar. this is so we load drivers from source tree during dev time but we load them a different way during the jar’s run time. It feels funny but i can’t figure out if it actually is funny
I don't think it is. :)
But FWIW I would move that check inside load-stuff and call load-stuff unconditionally. Then there no ambiguity anywhere.
that’s a simple way to make this all go away
why is-dev? instead of just dev?? The question mark is indicating a predicate, so is-test? providing that information twice.
fair point. i think it’s been around for a while and no one has bothered to change it. maybe other reasons i’m not sure
When coming from Java I tended to name predicates starting with is. But now I consider that noise.
yeah agree. these might have a bit of special circumstances around them
Is there a 'standard' library providing camelCase/kebab-case/snake_case tests and conversions and not much other bloat? I have my own code for this, but I'm happy to replace it with a lib.
Like this? Or something else? https://github.com/clj-commons/camel-snake-kebab
thx