Clojure

thread-bound? returns true (implying set! should succeed) even for non-binding thread

Details

  • Type: Defect Defect
  • Status: Open Open
  • Priority: Major Major
  • Resolution: Unresolved
  • Affects Version/s: None
  • Fix Version/s: None
  • Component/s: None
  • Labels:
    None
  • Patch:
    Code

Description

thread-bound? returns true for a non-binding thread, this result (according to the docstring) implies that set! should succeed. However, thread-bound? does not check that any binding that might exist was created by the current thread, and calling set! fails with an exception when it is called from a non-binding thread, even though thread-bound? returns true.

thread-bound? should return false if there is a binding, and that binding was not established by the current thread.

Activity

Hide
Paul Stadig added a comment - - edited

I have attached a patch that changes clojure.lang.Var and clojure.core/thread-bound? to only return true if a Var is set!-able.

Show
Paul Stadig added a comment - - edited I have attached a patch that changes clojure.lang.Var and clojure.core/thread-bound? to only return true if a Var is set!-able.
Paul Stadig made changes -
Field Original Value New Value
Attachment thread-bound.diff [ 11535 ]
Andy Fingerhut made changes -
Patch Code [ 10001 ]

People

Vote (1)
Watch (0)

Dates

  • Created:
    Updated: