jaunt-lang / jaunt

[ABANDONED] A jaunt away from Clojure
https://github.com/jaunt-lang/jaunt/issues/157
134 stars 6 forks source link

Strict get #135

Closed arrdem closed 8 years ago

arrdem commented 8 years ago

Because (get t :- T ...) for any non-associative T is probably a bug and is really really hard to debug because of the implicit nil behavior of RT.get/clojure.core/get.

Fixes #108

arrdem commented 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.

mikera commented 8 years ago

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.

danielcompton commented 8 years ago

One thing I'd be concerned about is breaking (get nil :a). It's sloppy style, but not inconceivable.

arrdem commented 8 years ago

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.

2016-04-11-081423_368x139_scrot