<< Back to previous view

[CLJ-1038] Docstring for deliver doesn't match behavior Created: 07/Aug/12  Updated: 01/Mar/13  Resolved: 24/Aug/12

Status: Closed
Project: Clojure
Component/s: None
Affects Version/s: Release 1.3, Release 1.4
Fix Version/s: None

Type: Defect Priority: Minor
Reporter: Colin Jones Assignee: Colin Jones
Resolution: Completed Votes: 0
Labels: documentation

Attachments: Text File 0001-Update-docstring-for-deliver-s-actual-behavior.patch     Text File correct-deliver-docstring.patch    
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."



 Comments   
Comment by Stuart Halloway [ 10/Aug/12 1:48 PM ]

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

Comment by Rich Hickey [ 10/Aug/12 3:09 PM ]

Don't doc return

Comment by Stuart Sierra [ 24/Aug/12 7:41 AM ]

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

Generated at Fri Nov 21 13:22:55 CST 2014 using JIRA 4.4#649-r158309.