Need help?
<- Back

Comments (25)

  • slifin
    This is a case I never really thought about - if the key is missing today you'll get nil as the value and since Clojure is a nil punning language it usually does sensible behaviour in your programI 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 pathsThis 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 thisNormally for correctness I'd like to see specs at the boundaries for programs and different test suites for internal behaviours
  • hk__2
    Some explanations from https://clojure.atlassian.net/browse/CLJ-2961:> 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.
  • moomin
    This 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?
  • temporallobe
    We just updated one of our projects to 1.12.5, but I might push for 1.13 as this could be very useful, although an alpha version might raise questions.
  • ndr
    Is it only me or this sounds a bit counter to clojure philosophy?
  • thom
    Ah yes, the missing seventeenth way to validate function parameters.
  • exabrial
    I love the idea of clojure and perfect immutability, but holy crap I cannot grok the syntax. My C-trained brain explodes.