The Rants, Raves, Gripes, and Prophecies of Paul R. Potts

Contents by Category

Contents by Date

Favorite Links

My Wiki: main entrance
Slashdot
Boing Boing
Truthout
Gwydion Dylan
Paul Graham
Richard P. Gabriel

Fri, 07 Jan 2005 Programming Projects, Part 2

OK, let me talk a little more about what I'd like to accomplish with my hobby programming projects. If you've read Zen and the Art of Motorcycle Maintenance, consider this a Chataqua (that term comes a little more naturally to me given that I grew up pretty close to Chataqua, New York, and have been to programs there a number of times).

First of all, the primary goal is to learn some new concepts and languages. It is awfully difficult to learn programming idioms and concepts in the abstract, so I'll need to set myself some small projects. In particular:

Concepts

* Continuations. This is a big topic in the Scheme community, but in

most other languages continuations don't really exist. Nevertheless, the language research community considers continuations to be very important; they are considered an essential tool for compiling other languages, and now a number of people are talking about using continuations to simplify management of state in web applications. Nevertheless, they seem to be very difficult to explain: see recent threads on the Lambda the Ultimate weblog. I suspect that they are a little like closures and recursion in that they are easy to understand once you've used them for something, but experience with static languages actually hinders understanding. So, I'd like to use them for something. Perhaps a small web project using SISC. Perhaps for kicks I could then attempt to translate the same code into Common Lisp, which does not support continuations directly, using an implementation of continuations in Common Lisp, which might allow me to once and for all understand it, and also perhaps to port it again to Ruby, which supposedly features continuations as well.

* Macros. In the past I've attempted to write some Scheme macros, and

failed because of incompatibility of various Scheme implementations with the RSR5 standard. I've tried to write Dylan macros, but never quite got them right; the Dylan reference manual is not very useful as a tutorial, and it wasn't clear if the Gwydion Dylan implementation matched it properly. I suspect that I need to go back to Common Lisp and work my way through Paul Graham's On_Lisp, and then work from there to see if I can do the same thing in Dylan. I'd like to understand clearly all the varieties of macros and what people mean when they characterize a macro implementation as such-and-such, hygienic or not, functional or not, etc.

* Monads. Another concept that people on Lambda seem to have a great

deal of difficulty explaining. Haskell is probably the poster child of functional languages using monads.

Languages

* Scheme. I've used Scheme just enough to appreciate its simplicity

and usefulness; I've done some volunteer teaching, attempting to introduce grade school students to Scheme programming and recursion. It would be useful to dig a little deeper into Scheme to master continuations and macros in the language, and perhaps even write something useful in it.

* Common Lisp. I'm a little uncertain on this one; do I really want to

clutter my head with the huge extent of Common Lisp idioms and library functions? Should I consider Common Lisp to be a relic in and of itself, useful mainly for informing the design of newer languags, or the future, in which we'll just give up on less powerful languages and use Lisp? It seems a little difficult to keep Scheme and Lisp uploaded into my brain at the same time, kind of like switching between C and C++. But I can't deny the abstraction power of Common Lisp macros, and I'm really jonesing to work through Graham's book.

* Dylan. Yes, Dylan. Still my favorite multi-paradigm language.

Showing a few wrinkles and cracks, like a lack of native continuations, but still incredibly powerful if only for its multiple inheritance support, generic functions, multiple return values, full support for higher-order functions, and the possibilities of static typing and efficient compilation. (I keep hoping one day I can stop worrying about efficiency altogether, but that doesn't happen; what happens is that we try to take on bigger data sets and more complex algorithms). I keep hoping to find a piece of the Gwydion Dylan project where I can contribute something useful: even redoing error messages, or improving error checking, or basic documentation: these are the itches I'd like to scratch. But delving into the compiler is discouraging; I get frustrated by the compile times and daunting complexity of the Gwydion implementation's innards. The maintainers seem to have given up on Mindy, so there's an opportunity there: what would it take to write a tool that can boostrap a big Dylan implementation? (A hell of a lot, probably). I'm wondering if d2c really has a future. The Functional Objects compilers look a little more promising, but I haven't even gotten a toehold there, and I hate to have to keep rebooting to swap between Linux and Windows.

* Ruby. My favorite of the scripting languages, and the one that has

been the most enjoyable to use: it has a laughably simple syntax, takes ideas from many of my other favorite languages, and is refreshingly light on weird idioms, relying instead on a handful of common concepts like the code block (closure).

* Forth. Yes, Forth. If Lisp can be characterized as a "programmable

programming language," then Forth is another one. Aggresively simple in implementation, it is another one of the languages where the language gurus seem to expect you to be able to roll your own implementation. Forth is concise: both its great strength and great weakness, and enables metaprogramming, in its way. I've been doing a lot of embedded code work and looking at horribly complicated and error-prone implementations of relatively simple concepts. Much of this C code could be laughably simple in Forth, even the multi-threaded code; the code would probably shrink in size by at least a factor of ten, if not more. That's got to be worth exploring. I have not found a good implementation to try this out. I think it could run on a much less powerful embedded CPU than the one that it now requires. Even the exercise of refactoring into Forth words would surely teach me something about the refactoring I already attempt to practice.

* OCaml, Haskell, Erlang, D, Lua, etc. Perhaps worth looking at. So

many languages, so little time.

* NewtonScript?. To implement my own version; to play with. It could

be interesting to model the parent-proto inheritance concepts in a different language. If I could do something to contribute towards an open-source revival of the Newton, that would be great, but it is a little bit beyond my capabilities, what with the hardware engineering and prototyping.

If I could do some networking, produce some prototypes or code that I could use to get a new job, contribute to an open-source project, or use some of this code to further my weblog or other projects, that would be great too.

I'm looking at a few different languages now, primarily languages that allow at least some facility to create DSLs (Domain Specific Languages) and allow metasyntactic extension (macros). Here are the ideas, in no particular priority, broken down by language:

Projects

* Weblog Tools

I have a love-hate relationship with blosxom, my weblog software. It's Perl, which I loathe, but Perl made it very easy to install and allows it to use extensions in a uniform way. It's frustrating to extend and customize.

I've got a vague plan to build a weblog framework in Dylan, called Dybbler. I'd start by attempting to implement Markdown in Dylan. There's a basic web platform, called Koala. But I'm also told that it is not very far along, and that the startup time for d2c application code makes it frustrating to use compiled Dylan programs as CGI scripts.

It will also be difficult, if not impossible, to deploy a Dylan CGI on my ISP's site, at least without renting a dedicated server, so it would be an internal experiment for the time being. It might be possible to buy a fixed IP and host my own weblog at home, but I'm not sure I want to take that all on at once, what with security issues, spam and zombie attacks, and all that fun.

I'd like to arrange a better publishing mechanism. It would be nice if I could mail myself weblog entries and get them posted automatically. I spent a little time last night messing with my IMAP mail server and the Ruby IMAP support class. It was laughably easy to log in and walk through the messages and get header information, but the method to actually retrieve the message text seems to be either missing in action or obscure beyond belief.

In general, I'd say that the "let a thousand flowers bloom" world of web frameworks, Wikis, blogs, etc., is not really converging, something better is around the corner, and it isn't C# and it isn't Java.

* Embedded and Small Server Tools

I've got a bug up my rear end also about the need for more advanced tools in embedded systems. Java, including hardware Java implementations like ARM's Jazelle, seem promising, but as Peter Housel put it, once you've taken the red pill (using truly powerful languages), it is awfully hard to go back. A typical industrial embedded application is so mind-numbingly badly designed and over-implemented, it seems like there must be plenty of wasted memory and CPU to reclaim for the sake of using a rational toolset. One question I haven't seen answered adequately is whether I can build Dylan, Scheme, Common Lisp, or Ruby applications for a platform upon which I want to forbid not only garbage collection, but dynamic allocation altogether. Allocate everything on startup, and never cons, and never GC. It seems like this ought to be possible. Maybe a DSL Lisp dialect specifically for embedded code?

I'm also interested in seeing what I can get running on a Kuro Box ($160 micro-server platform). Could I get a JVM, SISC, web server, and database running on one of those things, to allow me to build a web application in Scheme, implementing state with continuations? What about using Common Lisp or Ruby on Rails? Any of these projects could turn into a useful article; all of them together could make a book.

* The Book

Then, there's the book idea. I've long wanted to write a book on Dylan programming and the Gwydion project. It might be more valuable to do a book on the Lisp family of dynamic languages for GUI, scripting, and web applications.

* And All the Rest

It seems like I'm proposing a lot. What I'm really trying to do is find my next job, one that I might enjoy doing. That's about it.

Oh, it would be nice to go back to school and get an advanced degree in computer science, but it would have to be a place like MIT or CMU that would teach me something useful about language implementation and design. And I'd have to get paid while I went, while still having time to raise my children. And I want to teach English, Math, Computer Science, and write science fiction too. And play Stick. Hmmm. One lifetime is starting to look like not quite enough. Maybe I could give up sleep. Maybe this is some kind of midlife crisis? I guess if you don't have goals you'll never get anything done; the key is deciding what to give up on.

[/root/geeky/programming/lispish] permanent link

Creative Commons License

Viewable With Any Browser