Discussion Board
Go to the previous messageGo to the following message
Current Forum: Homework 3 Forum
Date: Fri Sep 28 2001 9:44 am
Author: Lee, Peter <petel@cmu.edu>
Subject: Re: recursive

This is an interesting thread of discussion.

Whether the original example:

public int Blah() {
return someChildofThis.Blah();
}

is recursive depends on whether the child instance inherits this same implmentation of Blah() or not. There isn't enough of the code here to know for sure, but it certainly could be recursive because of inheritance. (For those of you who are still fuzzy on inheritance, just hold on --- we'll be spending more lecture time on this concept.)

As for tail-recursion, it turns out that Matt is not quite right about Java. Matt hinted that tail-recursive method calls can be implemented as direct goto's. While this is true for many languages, it is expressly disallowed in Java, for security reasons. The java 2 security manager requires the presence of all stack frames for all methods to appear on the run-time stack.

I don't think we will be getting into the details of the security manager in this course, but I do hope to explain more about tail recursion later. If not, then 15-212 goes into this in great detail.
Post response

Go to the previous messageGo to the following message
Current Thread Detail:
recursive      Cipriani, Jason A.      Thu Sep 27 2001 9:55 am       
Re: recursive      White, David      Thu Sep 27 2001 12:08 pm       
Re: recursive      Yuen, John      Thu Sep 27 2001 12:15 pm       
Re: recursive      Danish, Matt R.      Thu Sep 27 2001 12:42 pm       
Re: recursive      Cipriani, Jason A.      Thu Sep 27 2001 4:16 pm       
Re: recursive      Danish, Matt R.      Thu Sep 27 2001 7:38 pm       
Re: recursive      Lee, Peter      Fri Sep 28 2001 9:44 am       
Re: recursive      Danish, Matt R.      Fri Sep 28 2001 11:35 am       
Re: recursive      Lee, Peter      Fri Sep 28 2001 12:43 pm       

Back to previous screen