16 Aug 2000 13:33:18 GMT, Marcin 'Qrczak' Kowalczyk <[EMAIL PROTECTED]> pisze:

> fileOwner :: FileStatus -> UserID
> fileOwner (FS ptr) = unsafePerformIO $ hold ptr $
>     (#peek struct stat, st_uid) ptr

Or better. The only unsafe operations (that return a value which
requires liveness of some other value to be itself valid) are
* variations of plusAddr, and
* hiding the pointer in the C world while coming back to Haskell.

Having cheap touch (and thus hold), it's easy to make all peek variants
safe themselves. Remove hold here. Only the above operations need
care. The programmer has to ensure that values with finalizers are
alive during use of values based on them in the above sense.

ForeignObjs are unnecessary! Long live addFinalizer!

-- 
 __("<  Marcin Kowalczyk * [EMAIL PROTECTED] http://qrczak.ids.net.pl/
 \__/
  ^^                      SYGNATURA ZASTĘPCZA
QRCZAK


Reply via email to