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: > In a concatenative language, I believe evaluation order should be > unimportant. > For example: > f g h <=> (f g) h <=> f (g h) This is the associative property. You need to be careful calling it "evaluation order", though; evaluation order matters with respect to dataflow -- you can't fully evaluate an expression whose parameters aren't all known at evaluation time. > Does Forth have this property? Yes, except where you're using macros or other compiling words. > Another property that I expect from a concatenative language is that > any subsequence of terms can be replaced with a subroutine whose > definition consists of that subsequence, without changing the meaning > of the program. Yes; this is an important one for me. It's included in the new proposed "Concatenative" page. It's actually a direct consequence of the associative property. > I believe this follows from the description of Joy > that says that the syntax is a homomorphism to the semantics. I'm not familiar with that claim, but it is indeed important that the semantics and syntax have the same associative property. I don't know whether that makes it a homomorphism. I expressed this a while back by saying that "a concatenative language maps the associative operation of syntactic concatenation onto the semantics of an associative operation on functions." This isn't as good of a definition as the others we're considering, but it does say what you're examining here. > Does Forth have this property? Yes. > What about Enchilada? I believe so. > FWIW: I like Steven Apter's informal definition a lot. Concatenative > means Joy-like. I am really worrying so much about definitions because > I am interested in trying to get at the heart of what makes Joy so > darn interesting from a theoretical stand-point, so that I can talk to > academics and say "see, Joy is not like your language!" It's kind of odd to say that Postscript and Forth are Joy-like. But really, as long as you're just going by examples, you don't have a theory. That's okay; but it's not enough to make something interesting from a theoretical standpoint. > - Christopher -Wm