4 ms·
You raise a good point. Is there a linter available that would flag such non-portable code?
by jgalt212 8y ago
You raise a good point. Is there a linter available that would flag such non-portable code?
- saosebastiao 8y agoThere probably is, but I haven't used clojure for at least 4 years so I'm not the person to ask. Regardless, a linter might flag things like that, but in my experience the most pernicious ways that it hurts wouldn't be found because they exist outside the application due to IO boundaries. Things like API or database calls, etc.
- yogthos 8y agoyou get a warning from the compiler in ClojureScript when type coercion happens: cljs.user=> (+ "1" 1) ⬆ WARNING: cljs.core/+, all arguments must be numbers, got [string number] instead. at line 1 "11" You can also use Spec and Schema to validate data at the edges, so that you don't end up with unexpected inputs. I highly recommend doing that for any non-trivial projects.