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

People

Vote (0)
Watch (5)

Dates

  • Created:
    Updated:
    Resolved: