[racket] Destructors in Racket

From: Roman Klochkov (kalimehtar at mail.ru)
Date: Sat Aug 2 06:12:46 EDT 2014

 I have a structure, that has a filestream inside it. File have to be cosed, when the structure is not used anymore (so gargbage collected).

Is the best way to do
(require ffi/unsafe)
(register-finalizer my-obj
   (lambda (x) (close-output-port (obj-file x))))

?

It seems doing right thing, but why `ffi/unsafe'? Is it OK, when my program actually doesn't use FFI?


-- 
Roman Klochkov
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20140802/86476fae/attachment.html>

Posted on the users mailing list.