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

Colin Jones made changes -
Field Original Value New Value
Summary Docstring for promise doesn't match behavior Docstring for deliver doesn't match behavior
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.
Stuart Halloway made changes -
Approval Screened [ 10004 ]
Attachment correct-deliver-docstring.patch [ 11419 ]
Hide
Rich Hickey added a comment -

Don't doc return

Show
Rich Hickey added a comment - Don't doc return
Rich Hickey made changes -
Approval Screened [ 10004 ] Ok [ 10007 ]
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)
Stuart Sierra made changes -
Resolution Completed [ 1 ]
Status Open [ 1 ] Resolved [ 5 ]
Stuart Halloway made changes -
Status Resolved [ 5 ] Closed [ 6 ]

People

Vote (0)
Watch (1)

Dates

  • Created:
    Updated:
    Resolved: