Re: The Death of Finalizers

2002-10-21 Thread Alastair Reid
> [snip] How sad. It's an unfortunate hole in the specification and I > hope someone will come up with a way of fixing it someday. I don't think it'll happen until preemptive concurrency is more widely implemented. > In the meantime, I'm glad we have got a new function > atomicModifyIORef which

RE: The Death of Finalizers

2002-10-22 Thread Simon Peyton-Jones
| In the meantime, I'm glad we have got a new function |atomicModifyIORef | which I for one will use, when it gets into GHC's regular release. 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

RE: The Death of Finalizers

2002-10-22 Thread Simon Marlow
> Do we still have atomicModifyIORef? > > I don't know that there's that much point now that Haskell finalizers > are gone. I don't have a strong objection (esp. since it seems every > implementation now has it) but it doesn't seem so necessary now. It ought to be significantly faster than usin

RE: The Death of Finalizers

2002-10-22 Thread Simon Marlow
> | In the meantime, I'm glad we have got a new function > |atomicModifyIORef > | which I for one will use, when it gets into GHC's regular release. > > Just before this gets out of the door... any chance of calling it > > modifyIORef > > and documenting that it's atomic? Sometimes na

Re: The Death of Finalizers

2002-10-22 Thread Alastair Reid
> 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

Re: The Death of Finalizers

2002-10-22 Thread Ross Paterson
On Tue, Oct 22, 2002 at 10:37:17AM +0100, Simon Marlow wrote: > > | In the meantime, I'm glad we have got a new function > > |atomicModifyIORef > > | which I for one will use, when it gets into GHC's regular release. > > > > Just before this gets out of the door... any chance of calling it > >

RE: The Death of Finalizers

2002-10-22 Thread Simon Marlow
> > It has a different type: > > > > atomicModifyIORef :: IORef a -> (a -> (a,b)) -> IO b > > modifyIORef :: IORef a -> (a -> a) -> IO () > > It would break backwards compatability, but > > modifyIORef_ :: IORef a -> (a -> IO a) -> IO () > modifyIORef :: IORef a -> (a -> IO (a, b

Re: The Death of Finalizers

2002-10-22 Thread Ross Paterson
On Tue, Oct 22, 2002 at 12:56:52PM +0100, Simon Marlow wrote: > Did you really mean those types, and not the types I quoted? That > implies unsafeInterleaveIO if they have to be atomic. Sorry, I meant the types you quoted. So the analogy isn't that strong. ___

Re: The Death of Finalizers

2002-10-22 Thread George Russell
Simon Peyton-Jones wrote: > > | In the meantime, I'm glad we have got a new function > |atomicModifyIORef > | which I for one will use, when it gets into GHC's regular release. > > Just before this gets out of the door... any chance of calling it > > modifyIORef > > and documenting

Re: The Death of Finalizers

2002-10-22 Thread George Russell
Simon Marlow wrote: > > > Do we still have atomicModifyIORef? > > > > I don't know that there's that much point now that Haskell finalizers > > are gone. I don't have a strong objection (esp. since it seems every > > implementation now has it) but it doesn't seem so necessary now. > > It ought t

Re: The Death of Finalizers

2002-10-22 Thread Dean Herington
George Russell wrote: > Simon Peyton-Jones wrote: > > > > | In the meantime, I'm glad we have got a new function > > |atomicModifyIORef > > | which I for one will use, when it gets into GHC's regular release. > > > > Just before this gets out of the door... any chance of calling it > > > >

Re: The Death of Finalizers

2002-10-22 Thread George Russell
Dean Herington wrote (snipped) > Here's the scheme I would > prefer for the "modify" subset of these functions. Existing functions are > labeled "(e)", proposed functions "(p)". "(*)" indicates an existing function > with a different interface. > > (e) modifyMVar :: MVar a -> (a -> IO (a, b))