Uploaded image for project: 'Clojure'
  1. CLJ-893

crafted `vec' call allows created vector to be mutated

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Completed
    • Affects versions: Release 1.4, Release 1.3
    • Fix versions: Release 1.5
    • Labels:
      None
    • Environment:

      Found in 1.3.0; tested in 1.4.0-alpha2 as well.

    • Approval:
      Ok
    • Patch:
      Code

      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.

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              alex+import import
            • Votes:
              1 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: