[PRL] almost tail-calling (was: Re: deeep stack)
Matthias Felleisen
matthias at ccs.neu.edu
Fri May 23 08:22:45 EDT 2008
On May 22, 2008, at 8:31 PM, John Clements wrote:
>
> My point is not that Java doesn't need to be tail-calling; it does.
> Instead, I'm simply pointing out that teaching students to write
> programs in a recursive fashion in Java is not as irresponsible as
> it's made out to be by loopfans.
You are absolutely correct. That's why "How to Design Classes" pushes
design-that-matches-data first and admits the possibility of failures
toward the end. This is the obligation we have: show students that
stack space is exhaustable in Java when Scheme runs in constant
space. Then we need to say "here are loops but they only work for
linear collections and traversals and even then they force you away
from OOP". -- Matthias
More information about the PRL
mailing list