Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number

comment on

( #3333=superdoc: print w/replies, xml ) Need Help??
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

In reply to On timely destruction? by Elian

Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":

  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?

    What's my password?
    Create A New User
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others cooling their heels in the Monastery: (9)
    As of 2021-03-04 14:47 GMT
    Find Nodes?
      Voting Booth?
      My favorite kind of desktop background is:

      Results (104 votes). Check out past polls.