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

transient set "keys" and "values" wind up with different metadata

    Details

    • Type: Bug
    • Status: Open
    • Priority: Minor
    • Resolution: Unresolved
    • Affects versions: Release 1.6
    • Fix versions: None
    • Patch:
      Code and Test

      Description

      (let [s (-> #{} 
                transient 
                (conj! (clojure.core/with-meta [-7] {:mynum 0}))
                (conj! (clojure.core/with-meta [-7] {:mynum -1})) 
                persistent!)]
        [(meta (s [-7])) (meta (first s))])
      => [{:mynum -1} {:mynum 0}]
      

      basically it looks like the "key" (the value we get by seqing on the set) retains the metadata from the first conj! but the "value" (what we get by calling invoke with the "key") carries the metadata from the second conj!. This does not match the behavior if we don't use transients:

      (let [s (-> #{} 
                (conj (clojure.core/with-meta [-7] {:mynum 0}))
                (conj (clojure.core/with-meta [-7] {:mynum -1})))]
        [(meta (s [-7])) (meta (first s))])
      => [{:mynum 0} {:mynum 0}]
      

      (found playing with zach tellman's collection-check)

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              michaelblume Michael Blume
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated: