Closed arrdem closed 8 years ago
Since this is a breaking change, unlike the warning changes which I've merged to date, I'm not sure if it's more appropriate to just sit on this until 1.0.0
when deprecated features will be removed anyway or whether I should just fold it into 0.3.0
.
I'm inclined to say break it. I think this is a logical inconsistency on the part of Clojure: it is reasonably sensible to interpret nil as an empty sequence but much more of a stretch to interpret it as an empty map.
However you might want to think about the get-in
, assoc-in
and update-in
cases as well.... ideally you want these to play nicely with missing keys.
One thing I'd be concerned about is breaking (get nil :a)
. It's sloppy style, but not inconceivable.
Looks OK to me. There may be some opportunity for yak shaving with regards to the particular implementation of RT.get
, which delegates to RT.getFrom
critically in the interesting nil
case in order to reduce method bytecode size and get better inlining behavior but I don't think I'm prepared to muck with that quite yet.
Because
(get t :- T ...)
for any non-associativeT
is probably a bug and is really really hard to debug because of the implicit nil behavior ofRT.get
/clojure.core/get
.Fixes #108