fanf: (Default)
[personal profile] fanf
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...

Date: 2006-06-09 13:44 (UTC)
From: [identity profile] sevenstring.livejournal.com
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 (http://www.opendylan.org/) 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.

Wouter Van Oortmerssen's languages

Date: 2006-06-11 19:49 (UTC)
From: [identity profile] shae.livejournal.com
Wouter does a few eigenlanguages.

January 2026

S M T W T F S
    123
45678910
1112 13 14151617
18192021222324
25262728293031

Most Popular Tags

Style Credit

Expand Cut Tags

No cut tags
Page generated 2026-02-08 12:33
Powered by Dreamwidth Studios