defn-spec VS truss

Compare defn-spec vs truss and see what are their differences.

defn-spec

Add function args and return Spec checking via assertions (by Provisdom)
InfluxDB - Power Real-Time Data Analytics at Scale
Get real-time insights from all types of time series data with InfluxDB. Ingest, query, and analyze billions of data points in real-time with unbounded cardinality.
www.influxdata.com
featured
SaaSHub - Software Alternatives and Reviews
SaaSHub helps you find the best software and product alternatives
www.saashub.com
featured
defn-spec truss
1 4
53 296
- 0.0%
0.0 5.9
7 months ago 8 days ago
Clojure Clojure
Eclipse Public License 1.0 Eclipse Public License 1.0
The number of mentions indicates the total number of mentions that we've tracked plus the number of user suggested alternatives.
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.

defn-spec

Posts with mentions or reviews of defn-spec. We have used some of these posts to build our list of alternatives and similar projects. The last one was on 2022-01-20.
  • Python dataclass equivalent
    7 projects | /r/Clojure | 20 Jan 2022
    if all you care about is information / documentation, and maybe validation, then spec or malli are fine. using spec during runtime to simulate a type system is a poor choice in most cases, because you are doing runtime type checking (something akin to dependent types or even esoteric contracts that are hard/impossible to express statically). There are some libs that help bolt a typed facade (using spec) onto the familiar defn / fn, https://github.com/gnl/ghostwheel https://github.com/Provisdom/defn-spec .

truss

Posts with mentions or reviews of truss. We have used some of these posts to build our list of alternatives and similar projects. The last one was on 2023-01-25.
  • Java 21: What’s New?
    1 project | news.ycombinator.com | 9 Aug 2023
    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
    7 projects | /r/Clojure | 25 Jan 2023
    I use truss extensively throughout my code to prevent those types of errors.
  • Python dataclass equivalent
    7 projects | /r/Clojure | 20 Jan 2022
    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
    6 projects | /r/Clojure | 22 Dec 2021
    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.