Details
-
Type:
Defect
-
Status:
Closed
-
Priority:
Major
-
Resolution: Completed
-
Affects Version/s: Release 1.3, Release 1.4
-
Fix Version/s: Release 1.5
-
Component/s: None
-
Labels:None
-
Environment:Found in 1.3.0; tested in 1.4.0-alpha2 as well.
-
Patch:Code
-
Approval:Ok
Description
user> (let [a (to-array (repeat 31 0)), v (vec a)]
[(v 2) (do (aset a 2 'no) (v 2))])
[0 no]
user> (let [a (to-array (repeat 33 0)), v (vec a)]
[(v 2) (do (aset a 2 'no) (v 2))])
[0 0]
While a relaxation of when different changes to the environment are made may impact the resulting value of the vector, as it is with lazy seqs, it oughtn't be possible to get two different results for the same access, just as with lazy seqs.
The code path followed here lets vec assume (without copying) a passed-in array. to-array just returns the array, and createOwning doesn't copy either.
Seems like we need a defensive copy somewhere