62 points · by tosh · 9y ago · 26 comments
Rees maintains a related archive [most recently updated 2010] on his page at http://mumble.net/~jar/tproject/
That in turn links to Shivers's overview of T and the development of its compilers (including Orbit) at http://www.paulgraham.com/thist.html
I find this interesting because in a certain way, this reminds me of how the go assembler works (https://www.youtube.com/watch?v=KINIAgRpkDA).
For those who haven't seen the talk: basically the go compiler works on the assumption that pretty much all computer, in a way, move memory from one address to another, generate and handle interrupts, have call/return instructions and so on. Thus, the go compiler emits (IIRC) some sort of "intermediate assembler" (somehow similar to llvm's intermediate representation, but simpler) and then proceeds to "translate" such assembler to various platform native assembler. I clearly remember Rob Pike (in the talk) saying "so the task of supporting a new platform becomes a task in text processing" (okay, maybe it was worded a bit better).
This might be a bit tangential, but it is interesting how some "new" ideas aren't that new after all. But I guess this is due to Rob Pike's deep experience and history with computers.
I am also interested in the revival of this language, but I don't see what the point of that would be. Does anyone here feel the same way?
[1] http://web.archive.org/web/20070103020434/http://mumble.net/...
[2] http://s48.org/
https://en.wikipedia.org/wiki/PreScheme
PreScheme itself is possibly worth reviving esp with ref counting or Rust's type of no-GC safety. I know another LISP, Carp, is trying to do something like the latter.
Even though I read this years ago, I'm still having vertigo when reading the last part. So many people, so many ideas .. so much inspiration.
(OakLisp is another beautiful riff on Scheme. Like T, it too has been all but completely forgotten AFAICT.)
> It is not almost totally forgotten
That should, of course, have been "now", not "not".
do you have a link for this? It's difficult to search for.
update: ignore me, found a link in the comments: http://mumble.net/~jar/tproject/
first line: "It occurred to me recently that The T Project had no coherent presence on the web." :)
Kelsey and Hudak "Realistic Compilation by Program Transformation" POPL 1989
One goal of the project was to produce human-readable C.
- Larceny: https://en.wikipedia.org/wiki/Larceny_(Scheme_implementation...
(Personally, I haven't explored any of these yet. I plan to get into scheme-to-C compilation some day. I think it's the future of programming, but I might be wrong.)
Moving towards Scheme-to-C is moving towards solving all performance/concurrency/what-not problems of a high-level-language like Scheme, without having to drop down to a low-level-language like C (or assembly). (I guess I should say that there might be a need for generating code for GPU, e.g., OpenCL. Just a heads up that I'm not trying to ignore that).
What I say has to be qualified with two very important assumptions:
- I believe 'large-scale programming' is 'research'. E.g., if the system you're building is under 20k-50k lines of code, give or take, it largely doesn't matter what paradigm you're using, or what language you're using. But for larger systems, the best way forward is to treat such a complex system as a research topic, and try to work at a higher level of abstraction, watch out for opportunities of creating new DSLs, and so on. (I believe this is part of the reason large projects do better in open source, firefox, linux, chromium, etc, etc. No manager is watching over your shoulders with a stick and a deadline on their notepad.).
- You have to think in terms of meta-programming. It comes in many flavors but take code-generation. Think of the whole purpose of your scheme code is to let you generate human-readable C code. For me, meta-programming means never having to write your program (here the program is the C code), but using tools and machines that write the program for you (here the tool and the machine is Scheme).
E.g., take a very large system like the linux kernel. It's 90% C with some assembly. A big motivation for my ideas comes from asking the question 'Can we develop and work at a high layer of abstraction in Scheme and create a code of ~100K to ~200K lines, that, using the ideas of meta-programming, compiles down to ~20M lines of C code which is functionally equivalent, as well as equally readable, to the current ~20M lines of the linux kernel?' (Note the scheme code size being 1% of the C code size!)
When you think along those lines, and realize that 21st-century large-scale programming is just getting started and something like a linux kernel is just the tip of the iceberg, you probably would reach many of the conclusions and beliefs that I gravitate towards.
Note that my ideas are in stark contrast to people who think the problem is that we need a new programming language. In that regard, I'm anti C++, D, Go, Rust, Swift, Kotlin, etc, etc. We don't need a new programming language. We need to treat the activity of programming as a research activity. (again, I'm talking about large-scale).
You know about Racket, right?
They're not kidding when they call it an ecosystem for developing new languages (indeed, racket itself is on some bleeding edges of language research, notably in the area of sound gradual typing with the ongoing typed racket project). Many Racketeers are researchers who take metaprogramming very seriously.
Racket currently uses the GNU lightning VM[1] via a JIT compiler, but is migrating onto the recently much-less-encumbered Chez (thanks, Cisco!).
https://groups.google.com/forum/#!msg/racket-dev/2BV3ElyfF8Y...
Recent update!
https://groups.google.com/forum/#!topic/racket-dev/rkXuHNAmQ...
Lightning and Chez both provide AOT features that Racket can use, although neither can really do source-to-source translation of Racket to C.
If you really want a modern scheme->C, then Chicken Scheme https://www.call-cc.org/ is your best bet. It gains some advantages by using (highly idiomatic) C as an intermediate language, but unfortunately then has to contend with C language idioms and constraints, especially C's runtime, which strongly constrains Chicken's approaches to concurrency.
I find it difficult to imagine that anyone will sit down and write a scheme->C compiler that produces human-readable C. You can see for yourself what Chicken emits, and that's still much more readable than the long-dead DEC Scheme->C's output.
Lastly, doing serious systems programming in Scheme is both feasible and has even been done. Sadly one extremely interesting example of this is decaying at http://www.scsh.net/ (the links to Shivers's papers are broken, and frankly they were the most entertaining parts of SCSH) although some ideas originating in SCSH have been ported to other Scheme implementations.
[1] kinda. http://lists.racket-lang.org/dev/archive//2014-September/014...
Note that Chez takes this approach, and is faster than Chicken, which compiles to C.