Re: [stack] Properties of Concatenative langauges and Forth

"William Tanksley, Jr" <[email protected]>
Newsgroups gmane.comp.lang.concatenative
Message-ID <[email protected]>
Christopher Diggins <[email protected]> wrote:
> Forth without compile-time words isn't Turing-complete as far as I can
> tell. I don't think you can just give it a pass. Can you even
> construct a conditional expression in Forth without compile-time
> words?

Sure, but you have to have some way of deferring a word inside a
definition (i.e. getting a reference to a function rather than
executing it). The "Furphy" language takes an approach like Joy's, by
providing a quotation primitive and redesigning the control words to
expect quotations on the stack rather than using compiling words...
It's easier to treat the compiling words as syntax, which they are.
And aside from that syntax, Forth is concatenative -- just as Joy,
aside from its quotations and the inability to simplify inside
quotations, is concatenative.

The perfect concatenative language hasn't been invented. But the field is young.

(Out of modesty, I haven't made the claim that the "oi" or "01"
languages Kerby and I produced is fully associative and therefore
perfectly concatenative. Well, modesty and a deep sense of shame at
the horror that I produced by asking that fateful question.)

>> The concatenative requirement is sensibly limited to expressions
>> within the language. In certain cases, it might be required to expand
>> the macros to get the concatenative expression. I think we can
>> sensibly talk about a concatenative language "plus macros". Factor
>> offers a good example; just because there exists a macro for locals
>> doesn't make the language non-concatenative.

> Macros sure, but your earlier statement included compile-time words.

Macros are compile-time words that consume source code text. They're
worse, not better, in terms of simplification.

>>> It's kind of odd to say that Postscript and Forth are Joy-like.
>> Indeed.
> I disagree. Joy is a nearly pure example of a special class of
> programming languages. If you remove the side-effects, you are left
> with a calculus of stacks. Forth and Postscript exhibit some of those
> properties, but not all, and contain a number of odd hacks and special
> constructs. IMO Joy is much more interesting to study formally than
> Forth and Postscript because of its purity.

Joy was designed for that purpose. Forth and Postscript were designed
before that purpose was even imagined. So yes, Joy is special; but
it's not even close to the most specialized. 01 is stronger in that
way, and it's a terrible language in all other ways.

> See my other post about the evaluation of a concatenative language, to
> get a sense of why Joy is special.

Everything you said there applied to Forth and Postscript as well. I
didn't notice anything that was special. Note that Joy has a similar
disadvantage to Forth, since it has a quotation syntax -- it's better
than Forth in one respect, since its quotation syntax is simple to
recognise, while Forth's compile time words have to be recognized
ad-hoc. OTOH, Joy's ability to treat quotations as lists means that
quotations can't always be simplified, which is arguably much worse.
The ideal Joy-like language would have quotations, but keep them
distinct from lists.

> - Christopher

-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.