We're updating the issue view to help you get more done. 

defn :or form does not warn you if you provide a vector instead of a map

Description

I had a problem defining a function today, I passed :or a vector instead of a map - everything seemed to work fine but later on I got a really puzzling "Null pointer exception".

raek helped me debug the problem and suggested opening this ticket. I think it would be useful if an exception was thrown on the :or line unless it's given a map.

Here are some examples

(defn broken-example [{:keys [i processor]
:or [processor identity]}]
(processor i))

(defn working-example [{:keys [i processor]
:or {processor identity}}]
(processor i))

(working-example {:i 1})
=> 1
(broken-example {:i 1})
=> Null pointer exception

Cheers, Dave.

Environment

Clojure 1.3, Emacs 23, OSX Lion

Status

Assignee

Unassigned

Reporter

import

Labels

None

Approval

None

Patch

None

Fix versions

Affects versions

Release 1.3

Priority

Trivial