Dan Sugalski wrote:
> 
> At 10:03 PM -0500 2/26/03, Benjamin Goldberg wrote:
> >I would not have suggested such a thing.  Tail call optomization in
> >parrot should be about the same logical semantics as perl5's goto
> >&subname (except maybe being faster).
> 
> No it shouldn't. Tail call optimization is far more useful in the case
> of:
> 
>     sub foo {
>        # do something
>        bar();
>     }
> 
> or
> 
>     sub foo {
>       # do something
>       foo();
>     }
> 
> than in perl's "goto &foo" feature, if for no other reason (and there
> are other reasons) than it's far more common.

The above two things *could* be written as:

   sub foo {
      # do something
      @_ = (); goto &bar;
   }

or

   sub foo {
      # do something
      @_ = (); goto &foo;
   }

These are, for all intents and purposes, tail-call optimized versions of
the two functions you showed.  True, this might not gain us much speed
in perl5, but it demonstrates the type of effect that I think that we're
aiming at, for parrot's tail-call optimization -- except of course that
in parrot, it would hopefully be faster.

-- 
$;=qq qJ,krleahciPhueerarsintoitq;sub __{0 &&
my$__;s ee substr$;,$,&&++$__%$,--,1,qq;;;ee;
$__>2&&&__}$,=22+$;=~y yiy y;__ while$;;print

Reply via email to