[racket] Semaphore obscurities

From: Norman Gray (norman at astro.gla.ac.uk)
Date: Wed Sep 26 17:16:33 EDT 2012

Ryan, hello.

On 26 Sep 2012, at 22:09, Ryan Culpepper <ryan at cs.utah.edu> wrote:

>> The documentation says:
>> (call-with-semaphore	 	sema	 	 	 	
>>  	 	proc	 	 	 	
>>  	 [	try-fail-thunk]	 	 	 	
>>  	 	arg ...)	 	→	 	any
>> However it appears that the try-fail-chunk argument is not in fact optional.
> Here's what the documentation means: There must be at least two arguments. The first two arguments are 'sema' and 'proc'. If there are three or more arguments, the third argument is 'try-fail-thunk'. If there are four or more arguments, all arguments starting with the fourth argument are collected in a list for the 'args' rest argument.

That certainly makes sense (and matches the behaviour), but in that case, I'd have expected to see

(call-with-semaphore sema proc [try-fail-thunk arg …])

With the […] round only try-fail-thunk, I interpret this documentation fragment, in combination with the parallel text, as meaning that if there is a third argument, and it is either a procedure or #f, then it is interpreted as 'try-fail-thunk', but if the third argument is not either of these, then it is interpreted as the first 'arg'.

>> Is that just an oversight, or is the return value
>> of CALL-WITH-SEMAPHORE undefined?
> It's probably an oversight.

Should I raise a doc bug, or ….

All the best,


Norman Gray  :  http://nxg.me.uk
SUPA School of Physics and Astronomy, University of Glasgow, UK

Posted on the users mailing list.