_Comment made by: michalmarczyk_
@Stuart:
To substantiate what was said above, here is the same code snippet evaluated at a Clojure 1.6 REPL and then again at a Clojure 1.7 REPL, both REPLs freshly started, with different results:
Clojure 1.6.0
(let [foo 1 bar 2
{:keys [foo bar]
:or {foo 3 bar (inc foo)}} {}]
[foo bar])
[3 2]
Clojure 1.7.0
(let [foo 1 bar 2
{:keys [foo bar]
:or {foo 3 bar (inc foo)}} {}]
[foo bar])
[3 4]
It is certainly not promised in the docs that there will be no surprising interactions between {{:or}} and {{:keys}}, but as demonstrated above, any existing code that depended on 1.6 behaviour has already been broken by 1.7. Specifying *some* behaviour and sticking to it in the future would prevent such surprises going forward.
I also think that the current behaviour is "random" in the sense that there is no principled reason why one might expect it – hence the proposal to make {{:or}} defaults refer to the enclosing scope that I've implemented in the patch.