Finalizers finalized
Ross Paterson
ross at soi.city.ac.uk
Mon Jan 20 08:05:30 EST 2003
On Fri, Jan 17, 2003 at 10:23:27AM +1100, Manuel M T Chakravarty wrote:
> Ross Paterson <ross at soi.city.ac.uk> wrote,
>
> > I'd also like to see the addition of
> >
> > mallocForeignPtrArray :: Storable a => Int -> IO (ForeignPtr a)
> >
> > to ForeignPtr, to save people from rolling their own. (Maybe the realloc
> > and 0 versions too?)
>
> The reason I didn't answer to this earlier is that I wanted
> to see how many people say that they support this addition.
> To be honest, I never needed a function like this. Did
> anybody else?
Only me, it seems. But surely if both mallocForeignPtr and mallocArray
are useful, this is too.
If you don't want to do explicit deallocation, mallocForeignPtr is
attractive (and handled specially by GHC). Sooner or later there are
going to be arrays, and then if there's no such function you'll have to
write your own.
More information about the FFI
mailing list