Thanks, i did see that, but at the time i skipped it because i wasnt involved in the '+' format

Now looking again i find i need to remember my $interp = Tkx::i::interp(); as at once point i wondered how to do that, but settled on using Tkx::info rather than the $interp->call('info','commands','::perl::*') i had seen somewhere(edit:add https://github.com/gisle/tcl.pm/blob/master/t/disposal-subs.t).

This issue is only related to after, and involves code modified in code disposal works, only 1 question remains; perl::Eval now in Tcl__new and added in the version 1.03 release as of 2016-02-20 https://metacpan.org/changes/release/VKON/Tcl-1.05. I suspect someone (vadrer?) saw that the commands-table/$anon_refs were filling up with address to single use anon-subrefs from the "after command" and wanted to clean them up. His approach while admirable hosed calls where the subref passed into after was not a single use anon-subref (or of the [$coderef] variety, since those generated a single use anon coderef too) because it prematurely discarded them from the Commands-table/$anon_refs.

While i have faith in my patch, and think it will solve the introduced problem while retaining the needed "code disposal", patching code is never as simple as it looks. What it does is introduce a "weakened" version of the coderef in the anon_refs table under the $tclname key it used to have pre v1.03 and copies that entry into a "strong" newer $current_r style name when needed, so it can be used in the "consolidated" $anon_refs that get scheduled for deletion. Now further "after" calls will be able to create their own consolidated entries for deletion but since the refcount will be greater than one for a "static" coderef since there will be multiple copies in multiple "consolidated" $anon_refs, when _code_disposal is called the Tcl::Code::DESTROY that purges that entry from the command table wont be invoked until the last consolidated $anon_refs entry has been destroyed.

Since code disposal is only invoked on "after" calls, for non-after calls i dispose of the weakened $tclname key right away, and those coderefs continue to live in the commands-table/$anon_refs "forever", just like they used to pre v1.03 and still currently do.


In reply to Re^2: Tkx after coderef problem by huck
in thread Tkx after coderef problem by huck

Title:
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, details, 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, summary, 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.