Clojure

crafted `vec' call allows created vector to be mutated

Details

  • Type: Defect Defect
  • Status: Closed Closed
  • Priority: Major 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.

Activity

People

Vote (1)
Watch (1)

Dates

  • Created:
    Updated:
    Resolved: