RE: Finalizers etcetera

2002-10-11 Thread Simon Peyton-Jones
| I claim that the major thing that finalizers do is manipulate shared | state. That is certainly true. If they were pure, you'd never know they'd run! | To get any benefit from writing finalizers in Haskell, I have to have | MVars which protect against finalizers. Nearly right, but not

RE: Finalizers etcetera

2002-10-11 Thread Simon Peyton-Jones
| type MVar# s elt-- primitive | | newMVar#:: State# s - (# State# s, MVar# s elt #) | takeMVar# :: SynchVar# s elt - State# s - (# State# s, elt #) | putMVar#:: SynchVar# s elt - State# s - State# s Bad idea to look at the primops. The important things are

Re: Finalizers etcetera

2002-10-11 Thread Malcolm Wallace
Simon Peyton-Jones [EMAIL PROTECTED] writes: | takeMVar# :: SynchVar# s elt - State# s - (# State# s, elt #) | putMVar#:: SynchVar# s elt - State# s - State# s Bad idea to look at the primops. (a) It was the first mention of MVars that I found in the docs. (b) I only really

RE: Finalizers etcetera

2002-10-11 Thread Simon Peyton-Jones
| (a) It was the first mention of MVars that I found in the docs. | (b) I only really mentioned it because the type sigs are wrong. Hmm. That's not very clever. | Doesn't it block if another thread manages to sneak a putMVar into | the middle? Maybe I should read your Awkward Squad paper to

Re: Finalizers strike back

2002-10-11 Thread Malcolm Wallace
George Russell [EMAIL PROTECTED] writes: it would normally be a good idea for implementations and programmers to provide and use MVars, even if they do not provide and use concurrency, ... If NHC does not provide MVars, I think it should. I don't think MVars make any sense without

Re: Finalizers strike back

2002-10-11 Thread Fergus Henderson
On 11-Oct-2002, George Russell [EMAIL PROTECTED] wrote: I think we should remember that the FFI standard has to address various audiences (1) those who want to implement portable code in just FFI + Haskell98. This group does not have access to functions for conveniently manipulating mutable

Re: Finalizers etcetera

2002-10-11 Thread Alastair Reid
| To get any benefit from writing finalizers in Haskell, I have to have | MVars which protect against finalizers. Nearly right, but not quite. You might write a Haskell finalizer that did lots of useful things (e.g. consulted a large pure data structure) before doing its state-mutation by

Re: Finalizers strike back

2002-10-11 Thread George Russell
Alastair Reid wrote: [snip] I'm not sure I really understand the problem. The FFI standard (Release Candidate 4, the one I have printed out here) does not define IORefs, and of course Haskell 98 doesn't either. Therefore, although this code is broken, this particular example doesn't

Finalizers 2: Bayou Justice (and Weak pointers to boot...)

2002-10-11 Thread John Meacham
For the record, I am strongly in favor of Haskell finalizers, if a Mutable State extension were to be written, then it will have to address the issue with one of the solutions mentioned in this thread, but among other things, not having haskell finalizers seems to imply that we would need to add