Clojure

Binding conveyance seems to be broken as of 1.6.0-alpha2

Details

  • Type: Defect Defect
  • Status: Closed Closed
  • Priority: Blocker Blocker
  • Resolution: Duplicate
  • Affects Version/s: Release 1.6
  • Fix Version/s: Release 1.6
  • Component/s: None
  • Labels:
    None
  • Environment:
    Clojure 1.6.0-alpha2
    java version "1.7.0_04"
    Java(TM) SE Runtime Environment (build 1.7.0_04-b21)
    Java HotSpot(TM) 64-Bit Server VM (build 23.0-b21, mixed mode)
  • Approval:
    Vetted

Description

With Clojure 1.5:

(def ^:dynamic *num* 1)
(binding [*num* 2] (future (dotimes [_ 10] (println *num*))))

Behaves as expected: "2" prints 10 times. With Clojure 1.6.0-alpha2 the same form will print "1"s off the main thread.

This seems to be an interaction between loop/recur and the binding conveyance: the num binding does convey without the loop:

(def ^:dynamic *num* 1)
(binding [*num* 2] (future (println *num*))) ; Prints "2" even with 1.6.0-alpha2

Activity

Hide
Alex Miller added a comment - - edited

I can confirm that the patch for this ticket is the one that introduced this behavior in 1.6:
http://dev.clojure.org/jira/browse/CLJ-1125

Show
Alex Miller added a comment - - edited I can confirm that the patch for this ticket is the one that introduced this behavior in 1.6: http://dev.clojure.org/jira/browse/CLJ-1125
Hide
Alex Miller added a comment -

Marking as a dup now handled by the new patch in CLJ-1125 (and test included there).

Show
Alex Miller added a comment - Marking as a dup now handled by the new patch in CLJ-1125 (and test included there).

People

Vote (0)
Watch (5)

Dates

  • Created:
    Updated:
    Resolved: