#132: Can't thaw a Sub (or a PIR subclass of a Sub)
--------------------+-------------------------------------------------------
 Reporter:  coke    |       Owner:  plobsing
     Type:  bug     |      Status:  new     
 Priority:  normal  |   Milestone:          
Component:  core    |     Version:          
 Severity:  medium  |    Keywords:          
     Lang:          |       Patch:          
 Platform:          |  
--------------------+-------------------------------------------------------

Comment(by plobsing):

 Replying to [ticket:132 coke]:

 It appears that not even a Sub proper can be thawed (likely because Subs
 aren't first class citizens as far as PBC is concerned).

 Code:

 {{{
 .sub main :main
   .local pmc pirC
   pirC = compreg 'PIR'

   .local string code
   code = <<"END_CODE"

 .sub bar
   say "hi"
 .end
 END_CODE

   .local pmc compiled
   compiled = pirC(code)
   .local pmc sub
   sub = compiled[0] # just want the first executable sub here.
   sub() # works

   $S0 = freeze sub
   say "frozen"
   $P2 = thaw $S0
   say "thawed"
   $P2()
 .end
 }}}

 Output:
 {{{
 hi
 frozen
 thawed
 zsh: segmentation fault  ./parrot test2.pir
 }}}

-- 
Ticket URL: <https://trac.parrot.org/parrot/ticket/132#comment:5>
Parrot <https://trac.parrot.org/parrot/>
Parrot Development
_______________________________________________
parrot-tickets mailing list
[email protected]
http://lists.parrot.org/mailman/listinfo/parrot-tickets

Reply via email to