I had an interesting idea in the shower the other day. C is a really bad language for implementing large software systems -- there are simply too many ways to shoot yourself in the foot. If you were going to implement an Operating System from scratch, why not use a better language like, say scheme? You get the compilability to native code, garbage collection, high level abstractions, incremental compilation, and avoid a lot of the problems that lead to security holes in a lot of software today.
There are a few problems with this approach. First, it would have to be Unix-like in nature; Unix has flat out won the battle for mindshare in OS design, and POSIX and C-level compatibility will be a necessity, eventually. Second, the whole idea of simple, little programs in /usr/bin and the rest of $PATH needs to stay; the idea of keeping everything in SchemeWorld just doesn't work for the average user. (This is a strong divergance from the standard Scheme POV, but it's only harmonizing Scheme with the rest of the world's idea of how an OS should work.) Finally, there's the issue of reimplementing a complete and functional userland (e.g. everything GNU in GNU/Linux). But if Scheme allows programmers to be so much more productive, this reimplementation shouldn't take all that long in the grand scheme of things. :-)
I promptly forgot about this idea. After all, it was one of those ephiphanies-in-the-shower. :-)
Then slashdot mentions this:
Schemix is a Scheme system, implemented as a patch to the Linux kernel. It aims to attain R5RS compliance while remaining small, fast and easy to understand.Hey, I said it was just an idea. I didn't say it was a good one...The intended use of Schemix is for exploration of the Linux kernel and for rapid, interactive prototyping of Linux drivers and other new kernel features. To achieve this, Schemix will attempt to make a large subset of the kernel functionality available to Scheme programs. Interactivity is via a character device, /dev/schemix which presents a REPL (Read, Eval, Print Loop) to anyone having access to the device.
Schemix is based on a stripped-down and modified version of TinyScheme. Currently the system can be successfully compiled into a 2.4.x kernel, which then reads and executes Scheme code from /dev/schemix. Any output is written to /dev/schemix.
-Dom
Re:Not forth?
ziggy on 2003-04-27T20:59:33
FORTH is not a safe language. It's actually more "dangerous" than C because there are no types and therefore no possibility of type checking your source code.
I have a sneaking suspicion that a future version of Windows is going to be just the CLR, and all user-level stuff will be written in C#. In other words, the whole OS will just be a virtual machine.
Maybe that'll be what it takes to get people away from unsafe languages like C and C++ for systems programming. I'd rather they use a nicer language like Perl 6 or Ruby, but knocking buffer overflows out of the top five most common programming errors will be nice.