<< Back to previous view

[CLJ-975] inconsistent destructuring behaviour when using nested maps Created: 19/Apr/12  Updated: 18/May/12  Resolved: 18/May/12

Status: Closed
Project: Clojure
Component/s: None
Affects Version/s: Release 1.1, Release 1.2, Release 1.3, Release 1.4, Release 1.5
Fix Version/s: None

Type: Defect Priority: Major
Reporter: Sunil S Nandihalli Assignee: Hubert Iwaniuk
Resolution: Completed Votes: 0
Labels: None

This should happen on any system. I have tested it on macs in version 1.4 and 1.2.1

Attachments: Text File CLJ-975-test.patch    
Patch: Code and Test
Approval: Ok


The way destructuring happens should not be affected by the fact that I have the same w at two-levels.
user>> (let [{{a :a b :b :as w} :c a1 :a b1 :b :as w} {:a 10 :b 20 :c {:a 30 :b 40}}] {:a a :b b :b1 b1 :a1 a1})
{:a 30, :b 40, :b1 40, :a1 30} <- unexpected behaviour.....

user>> (let [{{a :a b :b :as w} :c a1 :a b1 :b :as w1} {:a 10 :b 20 :c {:a 30 :b 40}}] {:a a :b b :b1 b1 :a1 a1})
{:a 30, :b 40, :b1 20, :a1 10} <- expected behaviour ..

Even having the :as things from both should not affet how others are destructured.. The email thread talking about the same is here


Comment by Hubert Iwaniuk [ 20/Apr/12 2:18 PM ]

Test to reproduce reported issue and code fixing it.

Comment by Hubert Iwaniuk [ 20/Apr/12 3:36 PM ]

Test to reproduce and clearly visualise this issue as well as code fixing it included.

Comment by Stuart Halloway [ 18/May/12 9:11 AM ]

A less eye-bleeding example

(let [{{inner :a :as w} :c outer :a :as w}
      {:a 10 :c {:a 30}}]
Generated at Wed Oct 18 15:26:25 CDT 2017 using JIRA 4.4#649-r158309.