From: Stephen Weeks (via RT) <[EMAIL PROTECTED]>
   Date: Tue, 02 Sep 2008 01:21:49 -0700

   # New Ticket Created by  Stephen Weeks 
   # Please include the string:  [perl #58506]
   # in the subject line of all future correspondence about this issue. 
   # <URL: http://rt.perl.org/rt3/Ticket/Display.html?id=58506 >

   The attached pir file tries to call a sub set :outer() another sub
   without calling the outer sub first.

This is almost guaranteed to cause problems.  For one thing, if "foo"
had ".lex" vars, they would be uninitialized.

   This fails with:
   too few arguments passed (0) - 1 params expected
   current instr.: 'bar' pc 3 (tlib.pir:4)
   called from Sub 'foo' pc 19 (tlib.pir:10)

The Closure:invoke method [1] has the following comment in the code that
implements its last-ditch attempt to make a LexPad:

                /* outer has never been invoked, we fake a subroutine call
                 * which builds the LexPad and return immediately
                 * this will usually just lead to a Null PMC access
                 * exception */

I suspect this faked call is what's causing the "too few arguments"
error (though none of my naive attempts to fix it worked).  If this case
is not covered by the test suite (I'm running an experiment now to see),
then it may have been broken for about two years now, which (IIRC) is
when strict parameter checking was turned on by default.

    So I doubt it should be fixed at all.  Patrick is in the process
redesigning how closures are taken, which will probably take care of it
anyway.

   Setting the outer sub to :load also works.

   . . .

   Any ideas?

That, I think, is your best bet.

                                        -- Bob Rogers
                                           http://rgrjr.dyndns.org/

[1]  Line 140 in src/pmc/closure.pmc

Reply via email to