[CLJ-1107] 'get' should throw exception on non-Associative argument Created: 13/Nov/12 Updated: 13/Nov/12 |
|
| Status: | Open |
| Project: | Clojure |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Enhancement | Priority: | Minor |
| Reporter: | Stuart Sierra | Assignee: | Stuart Sierra |
| Resolution: | Unresolved | Votes: | 1 |
| Labels: | None | ||
| Attachments: |
|
| Patch: | Code and Test |
| Description |
|
The implementation of clojure.core/get returns null if its argument is not a valid associative collection. However, calling 'get' on something which is neither nil nor an Associative collection is almost certainly a bug, and should be indicated by an exception. This behavior can obscure common programmer errors such as: (def a (atom {:a 1 :b 2})
(:foo a) ; forgot to deref a
;;=> nil
Attached patch 0001 throws an IllegalArgumentException as the fall-through case of RT.getFrom. |