<< Back to previous view

[CLJ-922] Transient maps lose values Created: 31/Jan/12  Updated: 31/Jan/12  Resolved: 31/Jan/12

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

Type: Defect Priority: Major
Reporter: Carl Lerche Assignee: Unassigned
Resolution: Declined Votes: 0
Labels: None
Environment:

OS X, java 1.6.0_29


Attachments: File bug.clj    

 Description   

I have tested this on the latest clojure 1.4 alpha (1.4.0-alpha5).

I am not exactly sure what the problem is w/ transient maps, but at a certain point they appear to lose values (values that are inserted into the maps w/ assoc! do not get saved).

I have a test script that illustrates this bug:

https://gist.github.com/497879a727dabac46ec3

All the values up to content-length are saved, but content-length never makes it into the transient map.



 Comments   
Comment by Tassilo Horn [ 31/Jan/12 1:20 AM ]

This is no bug, but you use assoc! wrongly. Just like with assoc, you need to use the return value of the call instead of "bashing the transient map in place". I.e., in your code, replace the doto with ->, which threads the result of each assoc! call to the next one, returning the last value.

BTW: This came up on the list the last days, too. See:

https://groups.google.com/d/msg/clojure/rmLLnRx5p3U/10GYNQdTVksJ

Comment by Tassilo Horn [ 31/Jan/12 1:21 AM ]

This is no bug but a usage error.

Generated at Tue Sep 02 00:00:42 CDT 2014 using JIRA 4.4#649-r158309.