[MLton] MLton.Thread.atomically

Daniel C. Wang danwang@CS.Princeton.EDU
Fri, 26 Mar 2004 17:20:52 -0500


Stephen Weeks wrote:
{stuff deleted}
> 
> I don't disagree that make_atomic is useful.  I even don't disagree
> that it might be more common.  I simply find that the type
> 
> 	('a -> 'b) * 'a
> 
> is less clear than
> 
> 	unit -> 'a
> 
> because, without careful thought, it's not clear that the only thing
> that can be done is to apply the first component to the second.
> Whereas with the thunk it is clear that the only thing that can be
> done is thaw it.  To me, the type says more, and I rate that very
> highly in interface design.

Hmm. if we are going to go ('a ->'b) * 'a route. I'd call it

val call_function_atomically : (('a -> 'b) * 'a) -> 'b

In this case, I'm always happier to have well defined names rather than 
types, as I can only figure out so much from the type without thinking too 
hard.