dcolthorp / matchure

Powerful, idiomatic pattern matching for clojure
159 stars 8 forks source link

Support for nil in if-match when matching nested expression #5

Closed tgk closed 13 years ago

tgk commented 13 years ago

It is not possible to (unsuccessfully) match a nested expression against a nil. The following will fail in the current version of matchure

(if-match [[?a] nil] true)

but the following will successfully return nil

(if-match [[?a] :foo] true)

tgk commented 13 years ago

The problem is in matchure.compile where the expression (.isArray (class ~matching-name)) will fail on a nil expression, as the class of nil is nil, and nil does not have .isArray.

tgk commented 13 years ago

Sorry, duplicate issue, see comment by Storkle.