truss
spec-tools
truss | spec-tools | |
---|---|---|
4 | 3 | |
296 | 591 | |
0.0% | -0.2% | |
5.9 | 4.0 | |
28 days ago | 9 days ago | |
Clojure | Clojure | |
Eclipse Public License 1.0 | Eclipse Public License 2.0 |
Stars - the number of stars that a project has on GitHub. Growth - month over month growth in stars.
Activity is a relative number indicating how actively a project is being developed. Recent commits have higher weight than older ones.
For example, an activity of 9.0 indicates that a project is amongst the top 10% of the most actively developed projects that we are tracking.
truss
-
Java 21: What’s New?
When type checking is needed, I find the Truss library* does the trick quite well.
As for the syntax, there is very little, which can make it a harder lift but once you have the hang of it you won't deal with the issues identified in the parent comment.
* https://github.com/taoensso/truss
-
Tired by the dynamicism
I use truss extensively throughout my code to prevent those types of errors.
-
Python dataclass equivalent
I haven't tried it myself. I generally just use truss for runtime constraint checking. I use a modified version that integrates scope-capture. And malli validation for more complex cases, but I try to limit that. For me it is better to validate individual attributes as needed, vs validating an entire "type"/collection of attributes. So each function only cares about the attributes that it needs, and validates only as needed.
-
Love Clojure, challenged by discoverability
Use assertions for all data requirements inside functions - I use a modified version of https://github.com/ptaoussanis/truss to ensure that I never get NullReference exceptions, and this also helps make functions more self-documenting. Also use this to assert return data.
spec-tools
- Which type declaration library is the standard nowadays?
-
More concise spec definitions
I'd like to use a syntax like how ::input-correlations-concise is defined, but am having trouble debugging the spec-tools.data-spec error ("Unable to resolve spec: :app.specs/input-correlations-concise") after setting it up with these instructions. I also want to make sure I'm doing things the "right" way.
-
Python dataclass equivalent
I like spec-tools data specs. I never got into schema, although I was aware of it. spec came along and swept a substantial portion of the crowd (I think the interleaving of parsing and regex style operators is slick/useful). Malli looks excellent though, and I think it's worthy of learning. I have no opinion on spec2 as of yet.
What are some alternatives?
portal - A clojure tool to navigate through your data.
scope-capture - Project your Clojure(Script) REPL into the same context as your code when it ran
malli - High-performance data-driven data specification library for Clojure/Script.
ghostwheel - Hassle-free inline clojure.spec with semi-automatic generative testing and side effect detection
snoop - Function instrumentation using Malli schemas.
python-nrepl
defn-spec - Add function args and return Spec checking via assertions
plumbing - Prismatic's Clojure(Script) utility belt
dataspectest - quick example of spec-tools dataspecs