From: Leopold Toetsch <[EMAIL PROTECTED]>
   Date: Sat, 3 Dec 2005 13:40:31 +0100

   On Dec 3, 2005, at 3:54, Bob Rogers wrote:

   >    In rev 10317, parrot segfaults if the sub named in ":outer" is not
   > defined in the current compilation unit.  The patch fixes the symptom,
   > and adds a test.  (But the error message could be improved.)

   Thanks, applied - r10320

   leo

Excellent; thank you -- and for the other fix especially.  But now I
notice that this is what happens if you put the inner sub first:

        [EMAIL PROTECTED]> ./parrot lexicals-30-rev.pir
        Undefined :outer sub 'foo'.
        [EMAIL PROTECTED]> 

So, at present, lexical subs must be emitted in preorder.  Is this a
bug, a TODO, or a conscious design decision?  (I'm hoping for "bug,"
BTW, since it's not mentioned in PDD20 . . . )

   Thanks again,

                                        -- Bob

.sub anon :outer(foo)
    .param pmc arg
    $P0 = find_lex '$n'
    # in practice we need copying the arg but as it is passed
    # as native int, we already have a fresh pmc
    $P0 += arg
    .return ($P0)
.end

.sub foo
    .param pmc arg
    .local pmc n
    .lex '$n', n
    n = arg
    .const .Sub anon = "anon"
    $P0 = newclosure anon
    .return ($P0)
.end

Reply via email to