Re: [stack] Advantages of cat, joy ..?
John Nowak <[email protected]>
| Newsgroups | gmane.comp.lang.concatenative |
|---|---|
| Message-ID | <[email protected]> |
On Feb 16, 2009, at 8:17 AM, chris glur wrote:
> What the point of it all ?!
1. The formal methods you mention are certainly a big element. The
pointfree, concatenative nature of the code makes it very easily to
manipulate programs. This property has not been taken advantage of yet.
2. Stack-based concatenative languages are well-suited to a linear
implementation; see Henry Baker's "The Forth Shall Be First" paper. I
may, however, be the only one interested in this.
3. First-order stack-based languages are well-suited to a graphical
representation once you apply a type discipline. This would mesh very
well with a linear implementation.
4. Concatenative languages can be considerably simpler than their
typical applicative counterparts. Throw out all your binding forms,
precedence rules, scoping rules, etc.
Other people undoubtedly have other interests.
> I recently investigated gforth
Gforth probably isn't what you want to be looking at. Factor is a
better bet, although it isn't currently capitalizing on the formal
methods you're talking about.
> [advantages of] knowing that language X can be viewed as a sequence
> of [transformations] of stacks?
It certainly makes it easy to move state through your program. This is
what enables the linear implementation I mentioned previously.
Similarly, it could make dealing with uniqueness types quite
comfortable.
The syntax also makes algebraic rules for a concatenative language
very simple. For example, you can express the distributivity of
multiplication nicely without the need for infix operators:
A B + C * == A C * B C * + == [*] papply bi +
You can also manipulate programs easily by prefixing them or suffixing
them. For example, if some program 'A' equals some program 'B', then
program 'F A' equals program 'F B' for any program 'F'. There is no
real equivalent for this prefixing rule in most programming languages.
(The suffixing rule is easy to translate though, e.g. 'A' -> 'A F' is
roughly the same thing as 'a' -> 'f(a)'.)
- John