Re: The Revenge of Finalizers

2002-10-16 Thread George Russell
(message referred to follows) Alastair suggested implementing blockFinalizers rather than PVars. However I dislike this for two reason: (1) I'm rather attached to PVars. Not just because I suggested them (actually I think I stole them from Einar Karlsen) but because it looks to me as if they

Re: Finalizers Ride Again

2002-10-16 Thread George Russell
Alastair Reid wrote: [snip] I don't see that it's necessary for us to come to a decision right now about PVars unless we want to put them in the FFI standard. But what if we can't agree on something like PVars or we decide that Haskell finalizers plus yet another synchronization

Re: declaring C enum types

2002-10-16 Thread Fergus Henderson
On 16-Oct-2002, Antony Courtney [EMAIL PROTECTED] wrote: Does anyone know off hand: - Is it a safe, portable assumption that enums will always be encoded as an unsigned short or 16-bit word? No, that assumption is not safe or portable. - If not, then how should enum values be

Why I want Haskell finalizers

2002-10-16 Thread George Russell
The document which Simon and Alastair have kindly put together asks for more details about why I want foreign garbage collectors to be able to call back to Haskell. Well I can't supply many details, because this is not immediately required by the UniForM/MMiSS project we are working on at

Finalizers compromise

2002-10-16 Thread George Russell
I like what Simon and Alastair have written in the finalizers document. However I don't think there is any proposal I can wholeheartedly support, so I have to produce my own, which is a mixture of almost all the proposals (1)-(5). I hope though that this proposal will at least provide a

Re: Why I want Haskell finalizers

2002-10-16 Thread Alastair Reid
George writes: If you have Haskell talking to some other language with a garbage collector, be it Java or SML, then at a given point of the program you can in general expect to have Haskell holding stable pointers to objects referenced from their world by the other language, and vice-versa.

Re: Why I want Haskell finalizers

2002-10-16 Thread George Russell
Alastair Reid wrote: George writes: If you have Haskell talking to some other language with a garbage collector, be it Java or SML, then at a given point of the program you can in general expect to have Haskell holding stable pointers to objects referenced from their world by the

Re: The Revenge of Finalizers

2002-10-16 Thread Alastair Reid
(2) blockFinalizers looks fine for Hugs and NHC which only have a single-thread model, but it looks tricky in general where [...] Ah, I see what you mean. I'd kinda hardwired into the definition the assumption that finalizers run at higher priority than other threads and that there's a

Re: Why I want Haskell finalizers

2002-10-16 Thread Alastair Reid
So what you want is for the Java GC to call hs_freeStablePtr on all the Haskell objects that just died? No, that's only a partial (and indeed very incomplete) solution. It relies on the Java GC knowing that that particular reference to the Haskell StablePtr is the only one that matters,

Re: Finali[zs]ers

2002-10-16 Thread John Meacham
it was less an argument either way and more of a statement of consequence as to what disallowing Haskell finalizers would cause. The problem can best be summed up by this snippet of the current FFI spec. excerpt from FFI: touchForeignPtr :: ForeignPtr a - IO () Ensure that the

Re: The Revenge of Finalizers

2002-10-16 Thread Ross Paterson
SimonM: [...] Can we easily identify which are the unsafe places and fix them? Alastair: Look at all prims with types in IO. Look at what data structures they touch. Check if there are accesses to that data structure 'both sides' of a call to eval (there may be a few functions which invoke