Clojure

Bindings after :as in list destructuring should throw error

Details

  • Approval:
    Ok

Description

If you try to define a vector binding with anything at all after an :as parameter, you do not get a compiler error, and the binding is silently swallowed:

user> ((fn [[:as y z]] y) [1 2])
[1 2]

If you try to actually use the binding, there will be a compiler error (the compiler will complain that there's no binding for the symbol), but the actual error has already happened, and should be reported earlier.

Activity

Hide
Alex Miller added a comment -

In 1.9, this now throws an error as the spec is violated.

Show
Alex Miller added a comment - In 1.9, this now throws an error as the spec is violated.

People

Vote (0)
Watch (1)

Dates

  • Created:
    Updated:
    Resolved: