Clojure 1.13 adds support for checked keys
clojure.org
Clojure 1.13 adds support for checked keys
1–10 of 50 posts
Re: Clojure 1.13 adds support for checked keys
#2I know this sounds unreliable but in practise I like a language that defaults to pragmatic code paths so I don't have to stay up at night imagining a million code paths
This adds a throwing codepath which is quite drastic so I'm glad people don't build this into programs everywhere - I'd be nice to hear what the team imagine as the use case for this
Normally for correctness I'd like to see specs at the boundaries for programs and different test suites for internal behaviours
Re: Clojure 1.13 adds support for checked keys
#3Re: Clojure 1.13 adds support for checked keys
#4Is it only me or this sounds a bit counter to clojure philosophy?
Many people (including myself) already have checked key variants for maps; this mainly extends the syntax to destructuring too.
Re: Clojure 1.13 adds support for checked keys
#5Is it only me or this sounds a bit counter to clojure philosophy?
Re: Clojure 1.13 adds support for checked keys
#6> Clojure’s idiomatic use of maps has proven valuable, but missing required keys, misspelled keys, and invalid values can lead to failures that do not connect to the actual source of the problem (e.g. NPEs) making diagnosis difficult. At the same time, Clojure lacks a simple inline mechanism for functions to document and check the keys they require and accept. Existing tools either separate those expectations from the function itself or couple data shape and data provision.
Re: Clojure 1.13 adds support for checked keys
#7Any news on ClojureScript gaining the feature?
Re: Clojure 1.13 adds support for checked keys
#8Re: Clojure 1.13 adds support for checked keys
#9Is it only me or this sounds a bit counter to clojure philosophy?
This will eliminate two whole classes of errors: 1) where keys are supplied a value at an undesired nesting-level. 2) where keys are not-yet-set for some other reason.
For the many programmers who have to write in checks and verifications themselves for this, this saves quite a bit of time, removing the interruption from coding and restoring the flow of getting logic-to-symbol.
Re: Clojure 1.13 adds support for checked keys
#10This is actually great, and I predict that fans of nil-punning will rapidly discover the joys of actually having errors trigger where the error was introduced rather than propagating through the program. Any news on ClojureScript gaining the feature?