[perl #60650] Lexical Associations Not Thawed with Tailcalls

[email protected] (chromatic)
Newsgroups perl.perl6.internals
Message-ID <[email protected]>
# New Ticket Created by  chromatic 
# Please include the string:  [perl #60650]
# in the subject line of all future correspondence about this issue. 
# <URL: http://rt.perl.org/rt3/Ticket/Display.html?id=60650 >


From t/pmc/exception.t test #26:

    .sub main :main
        .local pmc a
        .lex 'a', a
        a = new 'Integer'
        a = 42
        push_eh handler
        exit 0
    handler:
        .tailcall exit_handler()
    .end

    .sub exit_handler :outer(main)
        say "at_exit"
        .local pmc a
        a = find_lex 'a'
        print 'a = '
        say a
    .end

When run as PIR, the output shows that a is 42.  When compiled to PBC and run 
from PBC, this produces:

	at_exit
	a = Null PMC in say
	current instr.: 'exit_handler' pc 24 (t/op/exceptions_23.pir:17)

Remove .tailcall, recompile to PBC, and you get the correct answer.

-- c
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.