Keep Working, Worker Bee!

6.09.2005

I've been home sick today, and for whatever reason I couldn't stop thinking about PLT Scheme as a language for getting work done. I know that recently my research has been mostly theoretical, but I'm not actually much into that stuff — I'm much more interested in implementation. And as I've written more and more software in PLT Scheme, I think I've decided that I'm not a fan of its being untyped, as I think I've said; I really want static guarantees of correctness and I'm probably willing to deal with the occasional hacking around an artificial type shell game to get them (I'm thinking here of SML's system-interface libraries mostly). On the other hand, the ability to get complicated tree-structured data like XHTML without having to explicitly describe its shape first is useful.

But I'm not sure whether that's really appropriate for software that needs to be relied on; sure, unit tests are supposed to catch everything that type errors catch, but when you're coding at 100 miles an hour trying to get a feature done before tomorrow you'd really rather have it be caught before then. Also I can say from experience that taking a program written that way and releasing it to the world is an absolutely nerve-wracking experience no matter how much you've tested the code beforehand. (As it happens, I discovered exactly one type error on the speeddating site "in the wild"; in some cases I stuck something that wasn't supposed to be there onto an obscure error page that I'd forgotten to test. It affected a couple people before I fixed it.)

That said, I'm not really sure what the best alternative is. Whether it's purely an accident of history or not, the best web programming system I know of relies on Scheme and the typed alternatives seem pretty bad by comparison (with the exception of Haskell's WASH, though I like the Scheme server better). Maybe someone's doing something like the PLT server for OCaml -- that would be kind of exciting, actually, I really want to do some work with OCaml.

There are tremendous problems with web development in Scheme, some of which are shared by other functional languages (popular servers will cause resource-utilization issues eventually, but it's harder to get rid of them in languages that attempt to abstract all that stuff away than languages that put it in your face) and some of which aren't (PLT's database support still sucks and still needs to be improved dramatically --- another nerve-wracking part of launching the speed-dating site was that I was using a postgres driver I had no reason to trust with heavy load, though it turned out to work fine). But the killer language that would make me switch probably hasn't been invented yet. Maybe Links is what I want? I hope so.

2 Comments:

  • It seems that type systems always lag behind what we want from our languages. For example, type systems for very limited macro systems are a relatively recent advance. I don't know of any system that could handle, say, syntax-case.

    What about the soft typing approach -- statically type what you can, dynamically check what you can't? It seems the best compromise between the features that make Scheme great but difficult to type, and the 80% of code that is just SML with different formatting. When is MrFlow coming out? :-)

    As for the database support, Google will give you $4500 to fix that.

    By Anonymous Anonymous, at 03:34  

  • I definitely like the soft-typing approach, and I'm looking forward for a time when I can realistically typecheck programs with a real soft type checker. But in a language like Scheme with a strong tradition of syntactic extensions, I think a typechecker really needs to be extensible as well -- I'd love to be able to write a macro, give a type-checking rule for it, and then have the system use that typechecking rule instead of just checking the expanded code. For bonus points, if the system could be made to blame the macro code if something went wrong at runtime that was the expanded code's fault, that'd be great.

    By Blogger Jacob Matthews, at 10:08  

Post a Comment

<< Home