[CLJ-922] Transient maps lose values Created: 31/Jan/12 Updated: 31/Jan/12 Resolved: 31/Jan/12
|Affects Version/s:||Release 1.3, Release 1.4|
OS X, java 1.6.0_29
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:
All the values up to content-length are saved, but content-length never makes it into the transient map.
|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:
|Comment by Tassilo Horn [ 31/Jan/12 1:21 AM ]|
This is no bug but a usage error.