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

Peter Taoussanis made changes -
Field Original Value New Value
Description Hi - apologies if I've filed this incorrectly (or if it's a known issue) - first time using Jira.

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

Cheers :-)
- Peter
Hi - apologies if I've filed this incorrectly (or if it's a known issue) - first time using Jira.

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
```

Cheers :-)
- Peter
Alex Miller made changes -
Description Hi - apologies if I've filed this incorrectly (or if it's a known issue) - first time using Jira.

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
```

Cheers :-)
- Peter
Hi - apologies if I've filed this incorrectly (or if it's a known issue) - first time using Jira.

With Clojure 1.5:
{code}
(def ^:dynamic *num* 1)
(binding [*num* 2] (future (dotimes [_ 10] (println *num*))))
{code}

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:

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

Cheers :-)
- Peter
Alex Miller made changes -
Description Hi - apologies if I've filed this incorrectly (or if it's a known issue) - first time using Jira.

With Clojure 1.5:
{code}
(def ^:dynamic *num* 1)
(binding [*num* 2] (future (dotimes [_ 10] (println *num*))))
{code}

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:

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

Cheers :-)
- Peter
With Clojure 1.5:
{code}
(def ^:dynamic *num* 1)
(binding [*num* 2] (future (dotimes [_ 10] (println *num*))))
{code}

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:

{code}
(def ^:dynamic *num* 1)
(binding [*num* 2] (future (println *num*))) ; Prints "2" even with 1.6.0-alpha2
{code}
Alex Miller made changes -
Labels bug
Alex Miller made changes -
Description With Clojure 1.5:
{code}
(def ^:dynamic *num* 1)
(binding [*num* 2] (future (dotimes [_ 10] (println *num*))))
{code}

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:

{code}
(def ^:dynamic *num* 1)
(binding [*num* 2] (future (println *num*))) ; Prints "2" even with 1.6.0-alpha2
{code}
With Clojure 1.5:
{code}
(def ^:dynamic *num* 1)
(binding [*num* 2] (future (dotimes [_ 10] (println *num*))))
{code}

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:

{code}
(def ^:dynamic *num* 1)
(binding [*num* 2] (future (println *num*))) ; Prints "2" even with 1.6.0-alpha2
{code}
Alex Miller made changes -
Approval Triaged [ 10120 ]
Priority Minor [ 4 ] Major [ 3 ]
Alex Miller made changes -
Priority Major [ 3 ] Blocker [ 1 ]
Alex Miller made changes -
Fix Version/s Release 1.6 [ 10157 ]
Rich Hickey made changes -
Approval Triaged [ 10120 ] Vetted [ 10003 ]
Alex Miller made changes -
Resolution Duplicate [ 3 ]
Status Open [ 1 ] Closed [ 6 ]

People

Vote (0)
Watch (5)

Dates

  • Created:
    Updated:
    Resolved: