> [EMAIL PROTECTED] (Marcin 'Qrczak' Kowalczyk) wrote,
>
> > Wed, 16 Aug 2000 07:32:48 -0700, Simon Marlow
> <[EMAIL PROTECTED]> pisze:
> >
> > > I'm not sure I understand; how does autoPtrToBytes work if it
> > > doesn't use a ForeignObj?
> >
> > autoPtrToBytes:: Int -> IO (Ptr a)
> > autoPtrToBytes size = do
> > ptr <- mallocBytes size
> > addFinalizer ptr (free ptr)
> > return ptr
>
> This looks very nice. My only concern is that
> `addFinalizer' is a weak pointer operation, and thus, not
> part of the core FFI (which only provides ForeignObj and
> StablePtr).
We shouldn't mandate addFinalizer as part of the FFI at least until we have
a solution to the identity problem. The only safe addFinalizers are those
on primitive heap-resident objects (i.e. addForeignFinalizer, mkWeakIORef).
[ eg. our last thoughts on this were something like this:
barrier :: a -> IO a
as in fo <- newForeignObj a
fo' <- barrier fo
addFinalizer fo' (...)
... only use fo' ...
barrier is another null primop. But this is fairly ugly and
prevents some legitimate optimisations.
]
Cheers,
Simon
- Re: Accessing ForeignObj contents from ... Marcin 'Qrczak' Kowalczyk
- Re: Accessing ForeignObj contents f... Manuel M. T. Chakravarty
- Re: Accessing ForeignObj conten... Marcin 'Qrczak' Kowalczyk
- Re: Accessing ForeignObj c... Manuel M. T. Chakravarty
- Re: Accessing ForeignO... Marcin 'Qrczak' Kowalczyk
- RE: Accessing ForeignObj contents from ... Manuel M. T. Chakravarty
- RE: Accessing ForeignObj contents from Haskell Simon Marlow
- RE: Accessing ForeignObj contents from Hask... Manuel M. T. Chakravarty
- Re: Accessing ForeignObj contents from ... Marcin 'Qrczak' Kowalczyk
- RE: Accessing ForeignObj contents from Haskell Simon Marlow
- RE: Accessing ForeignObj contents from Haskell Simon Marlow
- RE: Accessing ForeignObj contents from Hask... Manuel M. T. Chakravarty
- Re: Accessing ForeignObj contents from ... Marcin 'Qrczak' Kowalczyk
- Re: Accessing ForeignObj contents f... Manuel M. T. Chakravarty
- RE: Accessing ForeignObj contents from Haskell Simon Marlow
- RE: Accessing ForeignObj contents from Haskell Simon Marlow
- RE: Accessing ForeignObj contents from Hask... Manuel M. T. Chakravarty
