Re: [stack] Properties of Concatenative langauges and Forth
"Christopher Diggins" <[email protected]>
| Newsgroups | gmane.comp.lang.concatenative |
|---|---|
| Message-ID | <[email protected]> |
On Fri, Jan 2, 2009 at 5:14 PM, John Nowak <[email protected]> wrote: > > On Jan 2, 2009, at 11:50 AM, William Tanksley, Jr wrote: > >> Christopher Diggins <[email protected]> wrote: >>> >> >>> f g h <=> (f g) h <=> f (g h) >>> Does Forth have this property? >> >> Yes, except where you're using macros or other compiling words. > > I think macros and compiling words get a pass. 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? > Saying they don't > wouldn't be much different than saying Haskell isn't purely functional > because top-level definitions can alter the meaning of other parts of > the program. Forth's dynamic nature obscures this a bit, but I think > it's essentially the same thing. I think this is an inaccurate comparison. > 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. >> 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. See my other post about the evaluation of a concatenative language, to get a sense of why Joy is special. - Christopher