caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* [Caml-list] Resource acquisition is initialization
@ 2002-12-11 19:19 Blair Zajac
  2002-12-11 19:55 ` Brian Hurt
  2002-12-12 13:15 ` Xavier Leroy
  0 siblings, 2 replies; 12+ messages in thread
From: Blair Zajac @ 2002-12-11 19:19 UTC (permalink / raw)
  To: Caml Users Mailing List

One of the nice things about C++ and Java is that with properly
designed classes, you don't need to worry about freeing resources
in complicated code, because the when the objects go out of scope
either normally or via an exception, they will clean themselves up.

Here's a good description of this idiom:

http://sourceforge.net/docman/display_doc.php?docid=8673&group_id=9028

Given that Ocaml has objects, it would be useful to have this
idiom available to us.  Is there a way to implement it, rather
than just waiting for the garbage collector?

Also, since objects have initializers, do they have finializers?  I
read the entire Oreilly book and didn't see any mention of them.

Reading the C code interface, it looks like you can associate a
finalizer function to clean up an abstract type, but can you do
this with normal Ocaml code?

Best,
Blair

-- 
Blair Zajac <blair@orcaware.com>
Plots of your system's performance - http://www.orcaware.com/orca/
-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners


^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2002-12-13 17:05 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-12-11 19:19 [Caml-list] Resource acquisition is initialization Blair Zajac
2002-12-11 19:55 ` Brian Hurt
2002-12-12  0:27   ` Chet Murthy
2002-12-12  7:56   ` Alessandro Baretta
2002-12-12 16:39     ` Brian Hurt
2002-12-13  9:22   ` Mike Potanin
2002-12-13 17:05     ` David Brown
2002-12-12 13:15 ` Xavier Leroy
2002-12-12 14:05   ` Dmitry Bely
2002-12-12 14:16     ` Xavier Leroy
2002-12-12 22:17   ` Quetzalcoatl Bradley
2002-12-12 23:59   ` Blair Zajac

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).