Re: [stack] Re. what's the point of cat-like ?

John Nowak <[email protected]> Tue, 5 Jan 2010 00:22:10 -0500
Newsgroups gmane.comp.lang.concatenative
Message-ID <[email protected]>
On Jan 4, 2010, at 7:07 PM, chris glur wrote:

> When it's too hard to explain, they revert to "try it, you'll like  
> it",
> or the new buzz-phrase: "good experience".

I'm going to answer this once and for all...

Joy and similar languages likely share the benefits of other pointfree  
approaches. There are two main differences between Joy and other  
pointfree languages like FP:

1) All primitives functions operate on terminated nested pairs (i.e.  
"the stack").

2) By convention, almost all primitives can be passed more arguments  
than they need which are simply returned unaltered (e.g. '+' returns  
everything beyond the top two elements unchanged).

The first point also has a corollary: Functions are never curried;  
higher order functions take the functions they operate on in the same  
product as the values to be operated on.

The second also has a corollary: Implementations inspired by linear  
logic become viable without a resource-aware type system or other  
means of enforcement; see Baker's "The Forth Shall Be First" paper.  
The utility of this is debatable.

Unfortunately, another corollary of of 2 is that programs can easily  
become overly sequential and opportunities for parallel reduction (and  
algebraic manipulation) are not syntactically obvious. Other problems  
exists but are more subtle.

For the benefits of pointfree programming in general, research via the  
links Tom and I posted. For the benefits of stack-based languages in  
particular, namely implementation simplicity, meta-programming, and  
code refactoring benefits, look to the Forth community.

You shouldn't need any further guidance on this question. If you're  
interested in pursuing it, I think there may be some fruitful research  
opportunities here.

- John