Re: implicit & explicit returns

2008-08-26 Thread Patrick R. Michaud
On Tue, Aug 26, 2008 at 11:42:51PM +0300, luben karavelov wrote: > I can run the NQP generated PIR after addition of: > > load_bytecode 'compilers/nqp/nqp.pbc' > > in the first sub. But I can not find how to run rakudo generated PIR > code. The "load_bytecode" seems no be not enought (some months

Re: implicit & explicit returns

2008-08-26 Thread luben karavelov
Jeff Horwitz wrote: the implicit return is by definition always at the end of a sub and therefore emits a PIR .return(). it's fast and easy. the explicit return, in contrast, could be anywhere in a subroutine, including loops, closures, etc. these constructs are also implemented using parro

Re: implicit & explicit returns

2008-08-26 Thread luben karavelov
Will Coleda wrote: On Tue, Aug 26, 2008 at 10:53 AM, luben <[EMAIL PROTECTED]> wrote: Is this on purpose? The implicit return is 4-5 times faster than explicit return. Best regards luben CC'ing perl6-compiler (where rakudo-particular items should go), and wondering if you can attach the gene

Re: implicit & explicit returns

2008-08-26 Thread Jeff Horwitz
On Tue, 26 Aug 2008, luben wrote: I have noticed that Rakudo (and NQP) generates different PIR code for implicit and explicit returns. Example for implicit return: sub foo($n){ $n; } And example for explicit return: sub foo($n){ return $n; } Is this on purpose? The implicit return is

Re: implicit & explicit returns

2008-08-26 Thread luben karavelov
Will Coleda wrote: On Tue, Aug 26, 2008 at 10:53 AM, luben <[EMAIL PROTECTED]> wrote: I have noticed that Rakudo (and NQP) generates different PIR code for implicit and explicit returns. Example for implicit return: sub foo($n){ $n; } And example for explicit return: sub foo($n){ return

Re: implicit & explicit returns

2008-08-26 Thread Will Coleda
On Tue, Aug 26, 2008 at 10:53 AM, luben <[EMAIL PROTECTED]> wrote: > I have noticed that Rakudo (and NQP) generates different PIR code for > implicit and explicit returns. > > Example for implicit return: > > sub foo($n){ > $n; > } > > And example for explicit return: > > sub foo($n){ > return