Destructuring support for namespaced keys and syms

Description

Expand destructuring to better support a set of keys (or syms) from a map when the keys share the same namespace.

Example:

Proposed: The special :keys and :syms keywords used in associative destructuring may now have a namespace (eg erson/keys). That namespace will be applied during lookup to all listed keys or syms when they are retrieved from the input map.

Example (also uses the new literal syntax for namespaced maps from ):

  • The key list after :ns/keys should contain either non-namespaced symbols or non-namespaced keywords. Symbols are preferred.

  • The key list after :ns/syms should contain non-namespaced symbols.

  • As :ns/keys and :ns/syms are read as normal keywords, auto-resolved keywords work as well: ::keys, ::alias/keys, etc.

  • Clarification - the :or defaults map always uses non-namespaced symbols as keys - that is, they are always the same as the locals being created (not the keys being looked up in the map). No change in behavior here, just trying to be explicit - this was not previously well-documented for namespaced key lookup and was broken. The attached patch fixes this behavior.

Patch: clj-1919-2.patch

Environment

None

Status

Assignee

Alex Miller

Reporter

Alex Miller

Labels

Approval

Ok

Patch

Code and Test

Fix versions

Priority

Critical
Configure