Here's a question for everyone. We're finalizing Parrot's object/variable destruction guarantees, and I'm trying to find out the common cases where dead-on timely destruction of objects is necessary, such that the lack of timely destruction would alter the semantics of the program badly enough to break it. With that in mind, I'm looking to tap the experience of the Monastery for such things. This is the last real chance to chime in--anything after this will have to be hacked in and likely will be slowish.
Keep in mind the following things:
- Don't worry about guts-level things (memory usage and such). That's my problem, and we've got it covered already
- You can install block-exit handlers, including in your caller's block, so you don't have to play DESTROY games to get lexical exit actions.
- Allocation failure (for example running out of filehandles) will trigger a GC sweep and retry of the failing operation, so your program won't run out of things for lack of timely cleanup.
I'm currently aware of exactly one case where this can be an issue. To wit:
{
my $foo; open $foo, "<bar.txt"; print "Baz\n";
}
{
my $foo; open $foo, "<bar.txt"; print "xyzzy\n";
}
where not doing timely destruction of the filehandle will potentially end up doing odd things to the program. Locks and such on files fall in the same general category. (This can be dealt with by having open push a GC sweep on the list of block exit handlers, but I can see niggly issues there)
Anyone have any others? Note that I don't generally consider a delay in cleaning up after a lexically scoped thingie that's escaped its scope a big deal. (For example, when a filehandle gets put in a global array that's later completely cleaned out) I can be convinced otherwise with sufficient argument, of course. :)
Update by myocom: Added <readmore> tag
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.
|