Could a Lisp be Blub?
gruseom: I've been thinking about this again because of the recent re-post of one of pg's Lisp essays (one of the two that originally provoked me into learning Lisp). The essay makes an argument that the answer to your question is roughly "No". The argument goes like this: no language that lacks Lisp-style macros can be as powerful as Lisp. Macros aren't possible without code=data, and code=data comes from sexps. But any language that represents programs as sexps is a variant of Lisp. So the only language that can be as powerful as Lisp is another Lisp.Now obviously we can argue about how to define "powerful", and the whole discussion can easily become another pointless language flamewar. But let's not do that. Let's provisionally grant the essay its definition of "powerful" and the corollary that Lisp macros are currently the apex of that power. The question is, is a more powerful (in this sense) language possible? (You don't have to agree with that definition of "powerful" to find the question interesting, by the way. Just rephrase it as, could another language beat Lisp at its own game?)In my mind I've always referred to the above argument rather pompously (i.e. half-jokingly) as "Graham's Thesis" (because it reminds me of what used to be called Church's Thesis when I studied logic - it's a non-provable-because-non-formal assertion that expresses an intuition about something - in that case computability, in this case programming languages). We can state Graham's Thesis as: Any programming language that's as powerful as Lisp is isomorphic to Lisp.So, is this true? The critical thing is code=data. Is there a fundamentally non-Lispy way to represent code as data, that's as good or better for programming than sexps? (That qualifier is important, because there are definitely ways to represent code as data that make a lousy notation for programming, e.g. machine language.) If there is such a representation, then a language based on exposing it as notation could be as powerful as Lisp without being Lisp. But if there isn't, then variations of sexps are the only game in town, and those don't count as new languages. Replacing parentheses with different brackets, as was suggested here either trollingly or stupidly the other day, doesn't cut it.As anyone who's seen a Lisp program and knows the first thing about a compiler knows, sexps are just the simplest notation for a syntax tree. That is, the thing that parsers turn programs in other languages into, Lisp programs just are. That makes sense, because parsers turn source code into data, and Lisp programs just are data. And any language in which you write programs as parse trees is Lisp (or will soon become Lisp as people add the obvious things you'd want in such a language).So Graham's Thesis (man I feel silly writing that) reduces to the following: the only representation of programs suitable as both a data structure and a notation for human programmers is the syntax tree.I'd really like to know if this is true. (Apologies to anyone who read my comment on this here the other day, as I'm repeating myself.) What languages are there whose source code gets turned into something that is fundamentally not a syntax tree? And what would the simplest explicit notation for that structure look like? I think this would be the area in which to look for an answer to the question.There's one thing that makes me think such a representation might not exist: sexps are really just function composition, and function composition is how humans have done math for a long time. But if one does exist, I'd like to see it. There are a lot of people here with much wider backgrounds in programming languages than mine, so perhaps someone can just answer this.