T
Tim Rentsch
Nobody said:Your statement was, recursion without TCO can't be used and
won't be used in a functional style. That statement is false.
My statement was that, without TCO, recursion cannot realistically replace
iteration.
Obviously that statement is false for a large class of programs.
Most of which are uninteresting. Most useful programs have at least one
unbounded loop, typically processing an input file or stdin until EOF.
I'm sure that's true for some value of 'n', but that's beside
the point. Your claim was that it can't be used, and that
claim was made without qualification as to the size of the
input. It's wrong. If you had said "It can't be used for
programs that have lists with 100 trillion elements in them",
I expect I would have agreed with you.
Most programs don't know the size of their inputs until run-time.
Let's face it: if the language doesn't have TCO, it is going to provide an
iteration primitive and any sane program is going to use it instead of
(non-branching) recursion.
The alternative, i.e. using memory proportional to the size of the input
*for no good reason*, isn't really an alternative.
But that's not what you said.
What I said was:
[Note: "really" and "much". IOW, you don't have a choice if you're trying
to write actual software rather than engaging in pedantic arguments.]
And:
Personally, I would consider exhausting the stack in a simple
read-process-write program (e.g. "cat") to be "not working".
Of course, some people have a very loose definition for "works". But I
can't think of anyone who would set the bar quite this low, other than for
the sake of argument.
What you did say is an overstatement. Of course
you might have meant something different from what you said, but my
response was a reply to what you said, not what you might have been
thinking.
No, I meant what I said. I didn't necessarily mean any and all possible
interpretations of what I said, even including interpretations which would
only be assumed for the sake of argument.
OTOH, I'm stil not entirely sure that you understand the issue. E.g.
bringing up recursive-descent parsers suggests that you may not.
The commentary above reads like a political ad: always quoting
selectively, and offering quotes after removing the previously
supplied context.
The letter of what you said (quoted exactly in my last posting, but
snipped in your response):
IOW, it can't be used,
isn't expected to be used, and won't be used in a functional style.
(This is only one comment, and it is quoted here without context;
but I encourage anyone who hasn't seen the previous postings to
look them up to see the original context for this statement and
also my reply to the posting that contained it.)
The spirit of what you're saying: In the absence of TCO, recursion
without iteration is for all practical purposes unusable.
If anyone disagrees with either of these, I invite them to look
at the record. I'm happy to consider any serious comments that
I have misunderstood the remarks in previous postings.
So now I will put this as a question: are you saying that
(absent TCO), recursion without iteration is unusable for
/all/ practical purposes, or are you saying that recursion
without iteration is usuable for /some/ practical purposes?
If the answer is "some", I agree with you.
If the answer is "all", I don't agree, and say again that
such a pronouncement is an overstatement.