Log in

No account? Create an account



« previous entry | next entry »
9th Jun 2006 | 02:50

I came up with a new word in the pub this evening. I was trying to remember Peter Van Roy's term "definitive language", which he uses to describe a language which is the ultimate refinement of a popular, well-understood programming paradigm. He argues that Erlang, E, and Oz are working towards the definitive concurrent functional language, and I suppose that C++/Modula-3/Java/C# are working towards a definitive object-oriented language.

But the word I came out with was "eigenlanguage" not "definitive language", and I was told that this has entirely the wrong implication: an eigenlanguage must be a language that is pared down to its essentials. Scheme (not Common Lisp), Forth (not Postscript), BCPL (not C++), etc. The fun thing about eigenlanguages happens when you push them as far as you can. Write code in the lambda calculus, or if that isn't hard-core enough, SK combinators! Single-instruction machine codes! Turing machines! Cellular automata!

I have an interesting eigenlanguage in my head. The "eigen" in this one is related to the data structure (singular) that programs manipulate.

One of the ugly things about Forth is that it has two stacks, one for expression evaluation and one for control flow. It's well-known that you can get significant fun out of making function return addresses explicit (continuation-passing style, and for the serious lunatics, call-with-current-continuation), which in Forth terms means using one stack for both purposes. For more interesting data, Forth descends to low-level array-of-words machine memory.

Lisp, however has nice lists/trees/pairs/do-what-you-like s-expressions. It's well-known that you can use a singly-linked list as a stack. But this stack doesn't have to be just a linear data structure like in Forth: it can be tree-like, or loopy, or whatever you like!

So why not try defining a language with only one data structure? A Lispish directed graph, which you can only manipulate via your single stack pointer, and which you have to code in continuation-passing Forth. If done properly, it can lead to some really elegant pessimizations such as multi-instruction sequences that implement the Forth primitives dup and exch.

However it is too late for me to go into the details now...

| Leave a comment |

Comments {3}

from: sevenstring
date: 9th Jun 2006 13:44 (UTC)

I'm not sure how one can have a `definitive' object-oriented language without multiple dispatch, which pretty much excludes all the non-Lisp entrants. (Assuming, that is, we count Dylan as a Lisp. That sounds fair enough though: it used to have S-expression syntax, and still has proper syntactic abstraction.) It's interesting to note that the post-Smalltalk advances on object-orientation have been pretty-much driven by Lisp. Multiple inheritance was introduced in Flavors (Zetalisp), multiple dispatch in LOOPS (Common Lisp) and meta-object protocols in CLOS. Your examples all seem rather limited in comparison.

I don't quite see how to implement call/cc with a Forth stack. I've never actually written Forth in anger, but I think I more-or-less got the hang a while ago. I suppose you could mess about copying the stack the hard way when capturing a (or, better, invoking a captured) continuation, but Forth's utterly hopeless memory management becomes a real problem. Though I suppose it might be possible to implement a consevative garbage collector in Forth, I doubt it would be very nice. Maybe that's the point, though.

Reply | Thread

Tony Finch

from: fanf
date: 9th Jun 2006 15:23 (UTC)

"Definitive" doesn't mean including the kitchen sink, it means having a refined collection of commonly-accepted features. Note that Java and C# are not as featureful as C++.

And regarding call/cc, you are right that you can't do it in pure Forth, but you could with my eigen-evil-thing.

Reply | Parent | Thread

Shae Erisson

Wouter Van Oortmerssen's languages

from: shae
date: 11th Jun 2006 19:49 (UTC)

Wouter does a few eigenlanguages.

Reply | Thread