# New Ticket Created by Klaas-Jan Stol # Please include the string: [perl #50424] # in the subject line of all future correspondence about this issue. # <URL: http://rt.perl.org/rt3/Ticket/Display.html?id=50424 >
hi, as far as I could see, it is not allowed to create empty PAST::Stmts nodes. (I might have done something else wrong, but I could not find any other reason). If such a node is left empty, then incorrect PIR is generated: "set $P, " Note the missing second operand. The solution is to create a PAST::Block, which can be empty (without statements). However, creating all these blocks might not be desired, as they translate to different subs. This has consequences for scoping (labels, lexicals) but also for performance. IMHO, it would be best to always have PAST nodes create correct PIR, (as long as you don't do really stupid stuff); leaving a Stmts node empty is not that strange, I think. A use-case for an empty Stmts node is this. Suppose you have a simple language, with syntax for an if statement as this: if 1 then # PAST::Stmts no. 1 else # PAST::Stmts no. 2 end This is correct input for the compiler, but having these blocks translate to PAST::Stmts node (no.1,2) will not work. Some language have different scoping rules (for instance, Ecmascript), or maybe a language implementer would like to implement the scoping/symbol handling differently. Thanks, kjs