The Death of Finalizers

Alastair Reid alastair at reid-consulting-uk.ltd.uk
Tue Oct 22 06:38:49 EDT 2002


> Just before this gets out of the door... any chance of calling it
>
> 	modifyIORef
>
> and documenting that it's atomic?  Sometimes names can get too long!

There's two reasons you might use the function: convenience and atomicity.

I can easily imagine someone modifying a program, thinking that it was
used for convenience, replacing it with non-atomic 'equivalent' code
and breaking the code in a way that will take a lot of testing to
find.  Being explicit that it has this special, important property
protects against that.

But what if I am only using it for convenience and I want to document
that fact?  One could make a good case for adding plain modifyIORef
which may or may not be atomic.  


Or, we can avoid the issue altogether by not adding an atomicity
guarantee.  If you use concurrency, use MVars, if you don't use
concurrency, you don't need it.  

--
Alastair




More information about the FFI mailing list