On Thu, Jul 21, 2005 at 09:59:57AM -0300, Adriano Ferreira wrote:
: 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.

Though, arguably, g is probably more interested in the context of f in
this case, so automatic tailcall optimization is not necessarily throwing
away any information that the return would not have to pass down to
g() anyway.  So I guess I agree that .tailcall is probably just a bad
synonym for "return".

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

Yes, presuming the delegator doesn't want to capture control again after
the delegation.  But delegation is just syntactic sugar anyway, so
if you want control back you should just write it that way explicitly
and the tailcall disappears.

Larry

Reply via email to