Support destructuring maps with namespaced keywords

Description

Current :keys destructuring expects symbols and creates local bindings based on those symbols. This works fine with maps that use non-namespaced keyword keys. This enhancement is to add support for destructuring maps with namespaced keyword keys.

Approach: Allow keywords (with or without namespaces) in :keys destructuring. Destructure to bindings with the name of the keyword (namespace is ignored).

Patch: clj-1318-6.diff

Screened by: Stuart Sierra. See comments, below.

Doc TODO: Will need to update http://clojure.org/special_forms#binding-forms with new binding form.

Environment

None

Attachments

6

Activity

Show:

David Nolen February 23, 2014 at 11:01 PM

Ported to ClojureScript with CLJS-745

Fogus February 7, 2014 at 8:23 PM

A potential point of confusion here is illustrated by the following:

To get the answer 3001 one needs to remove the conflicting binding :y/b. Maybe this is not a big deal, but expect questions for the next 100 years.

Alex Miller January 24, 2014 at 5:08 PM

Changed examples in description to use [].

Alex Miller January 24, 2014 at 5:07 PM

And also fixing :syms [] in -6 diff.

Alex Miller January 24, 2014 at 4:28 PM

Added new -5 diff that uses vectors instead of lists in :keys tests.

Completed

Assignee

Reporter

Approval

Patch

Priority

Affects versions

Fix versions

Created January 6, 2014 at 5:15 PM
Updated February 23, 2014 at 11:01 PM
Resolved February 23, 2014 at 11:01 PM