[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Tail Recursion in Common Lisp ???
"8/9 of this can of worms is below the surface". If the spec -allows-
tail-recursion optimization, and "my" implementation "supports"
tail-recursion, then "I" can, and most likely -will-, write a
"tail-recursive" program, which is theoretically portable, but in fact,
will blow the stack of most certified implementations that do not
"support" tail-recursion, and is thus, subtly, not portable.
There are a million issues like this. For example, Common Lisp will
also allow theoretically portable programs that are 10 megabytes in
size, and that will blow the memory on small, non-virtual-memory
machines. We don't want to outlaw large programs or efficient compilers
or any compilation technique that leads to more effective use of
resources just because not everyone will have it and someone might be
screwed by that.
Portability is an important goal of Common Lisp, but not the only goal.
The best we can do in this case is to spell out clearly what is allowed
and what is required, and let programmers decide whether they want to
depend on non-required efficiency mechanisms, knowing that not all
machines will have them.