On 7/20/05, Brent 'Dax' Royal-Gordon <[EMAIL PROTECTED]> wrote:
> <brentdax> Is there a Perl 6 tail call syntax, 

> One suggestion was a tweak of `can`'s definition: instead of returning
> a reference to the method, it returns one with the invocant already
> curried into it.  Thus, the above becomes this:

> Am I missing something?  How do you think a tail method call should be
> performed?

I can understand the convenience of turning a method into a subroutine
by currying the object. Syntactical support for this seems cool too.
But, can someone remind me why there is the need for an explicit tail
call syntax? It has to do with some oddity of Perl in some situations
that prevents the code generator to infer that should be a a tail
call? I am thinking about how tail calls are handled in languages like
Scheme or Lua. In these,

   sub f ( $a ) {
         return g($a);

urges for (and compiles to) a tail call with no need for explicit
marks by the programmer. Obviously, in Perl, there are some issues
with the calling context that should be propagated to the callee.

Also getting tail method calls right is an immediate win for the issue
of implementing delegation. Am I right?


Reply via email to