Re: [stack] disallowing recursive definitions

"William Tanksley, Jr" <[email protected]>
Newsgroups gmane.comp.lang.concatenative
Message-ID <[email protected]>
John Nowak <[email protected]> wrote:
>  William Tanksley, Jr wrote:
>  >> With a concatenative tail-call you're passing the stack as an
>  >> argument. In other words, you pass the entire state of the program!
>  > Yes, this is how concatenative languages are modeled. That's how
>  > *every* step in their execution is modeled, not just tail-calls or
>  > calls. If this were a problem, concatenative languages would be
>  > universally problematic, not merely problematic in the presence of
>  > tail-calls.
>  Indeed, and I'd argue that this is exactly why many people find stack-
>  based languages universally problematic. They're taking issue with all
>  of this state passing, although they phrase it like "I can't keep the
>  stack in my head". Of course this isn't a problem in practice,
>  particularly when you have type inference involved and can get a quick
>  summary of what a function cares about, but it does seem to be the
>  source of many negative first impressions.

Now we're treading on the marshy ground of subjective judgments... I
don't think we're going to resolve this in this manner. I disagree
that this is why some people find concatenative languages difficult,
but I suspect neither one of us can build a model strong enough to
refute the other's suspicions.

But I wasn't talking about subjective impressions; I'm talking about
mathematical analysis. We don't need to go into opinions.
Mathematically, every operation in a concatenative language is modeled
by passing the entire stack to each successive function, and yet the
mathematical analysis is exceedingly simple.

Therefore, if tail-calls are hard to analyze in a concatenative
language, the problem is NOT that "the entire stack is being passed".
The problem lies elsewhere.

Let me quote you: "No.  All you do is do an arbitrary stack shuffle
before the tail call."

Again, the problem is the stack shuffle, not the tail call. Analysing
the shuffle will untangle the entire problem, without having to
involve any analysis of the tail-call. This contrasts with a tail-call
in an applicative language, in which the tail-call is inseparable from
the changing of the values of the parameters.

>  - John

-Wm
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.