Clojure

with-local-vars broken after changes to make dynamic off by default

Details

  • Type: Defect Defect
  • Status: Closed Closed
  • Priority: Major Major
  • Resolution: Completed
  • Affects Version/s: None
  • Fix Version/s: Release 1.3
  • Component/s: None
  • Labels:
    None
  • Patch:
    Code and Test
  • Approval:
    Ok

Description

with-local-vars should create dynamic vars. Here is what happens now in HEAD

user=> (defn factorial [x]
(with-local-vars [acc 1, cnt x]
(while (> @cnt 0)
(var-set acc (* @acc @cnt))
(var-set cnt (dec @cnt)))
@acc))
#'user/factorial
user=> (factorial 5)
IllegalStateException Can't dynamically bind non-dynamic var: null/null clojure.lang.Var.pushThreadBindings (Var.java:352)

Attached is a patch to mark with-local-vars vars as dynamic, and a test to prove that it works using factorial .

Activity

Hide
Stuart Halloway added a comment -

patch was already applied but ticket never updated

Show
Stuart Halloway added a comment - patch was already applied but ticket never updated

People

Vote (0)
Watch (0)

Dates

  • Created:
    Updated:
    Resolved: