Clojure

Docstring for deliver doesn't match behavior

Details

  • Type: Defect Defect
  • Status: Closed Closed
  • Priority: Minor Minor
  • Resolution: Completed
  • Affects Version/s: Release 1.3, Release 1.4
  • Fix Version/s: None
  • Component/s: None
  • Labels:
  • Patch:
    Code
  • Approval:
    Ok

Description

The docstring for deliver doesn't match the actual behavior. It says an exception gets thrown on multiple delivers, but that's no longer the case, as of 1.3 (hat tip to clgv on irc).

user=> (doc deliver)
-------------------------
clojure.core/deliver
([promise val])
  Alpha - subject to change.
  Delivers the supplied value to the promise, releasing any pending
  derefs. A subsequent call to deliver on a promise will throw an exception.
nil
(let [p (promise)] 
  (deliver p "hi") 
  (deliver p "bye") 
  @p)
;=> "hi"

This patch updates the docstring to reflect actual behavior: "will throw an exception." -> "will have no effect."

Activity

Hide
Stuart Sierra added a comment -

CLJ-1038 Update docstring for deliver's actual behavior (patch applied Aug 15, 2012)

Show
Stuart Sierra added a comment - CLJ-1038 Update docstring for deliver's actual behavior (patch applied Aug 15, 2012)
Hide
Rich Hickey added a comment -

Don't doc return

Show
Rich Hickey added a comment - Don't doc return
Hide
Stuart Halloway added a comment -

Both patches are correct. Colin's patch documents the side effect, my variant also commits to the return values. Take your pick.

Show
Stuart Halloway added a comment - Both patches are correct. Colin's patch documents the side effect, my variant also commits to the return values. Take your pick.

People

Vote (0)
Watch (1)

Dates

  • Created:
    Updated:
    Resolved: