Lambda the Ultimate

inactiveTopic [The Creation of a Constraint-based Programming Language]
started 11/12/2002; 6:38:27 AM - last post 11/18/2002; 4:05:51 AM
Luke Gorrie - [The Creation of a Constraint-based Programming Language]  blueArrow
11/12/2002; 6:38:27 AM (reads: 3231, responses: 6)
[The Creation of a Constraint-based Programming Language]
I had to paraphrase the title to fit the maximum length, it's really:

The Definition and Implementation of a Computer Programming Language Based on Constraints, by Guy L. Steele (thesis)

This is a really wonderful piece of writing. What I got out of it was an introduction to constraint-based programming, a gentle tour of growing a language bit by bit, and an amazing demonstration of Lisp techniques for writing interpreters that fit in neatly with their host environment. (And I only read the first half!)

That said, it is book-length and the electronic copy is a scan. The result is 20 megabytes and challenging to print - but well worth the effort.
Posted to implementation by Luke Gorrie on 11/12/02; 7:30:09 AM

Luke Gorrie - Re: [The Creation of a Constraint-based Programming Language]  blueArrow
11/12/2002; 7:34:28 AM (reads: 2109, responses: 1)
I've been embedding a lot of small constraint systems in programs since I read this, for better or for worse :-)

Ehud Lamm - Re: [The Creation of a Constraint-based Programming Language]  blueArrow
11/12/2002; 9:01:23 AM (reads: 2139, responses: 0)
Examples please!

Ehud Lamm - Re: [The Creation of a Constraint-based Programming Language]  blueArrow
11/13/2002; 4:12:13 AM (reads: 1939, responses: 0)
I just reached chapter 2, but it seems that implementing the trivial constraint language in Prolog should be fun.

Luke Gorrie - Re: [The Creation of a Constraint-based Programming Language]  blueArrow
11/15/2002; 11:42:48 AM (reads: 1853, responses: 0)
The first place I used a constraint-like system was an input validation little language in the Java GUI of the Bluetail Mail Robustifier. It used constraints so that things could be coloured specially while they were invalid, with minimal local-propagation work. That implementation was in Scheme, and knocked off from SICP (don't think I'd read this Steele stuff at the time.) That was a fun program, with declarative specs for layouts, validation constraints, and mapping between values in actual GUI components and configuration update RPCs. The product has disappeared, but I found an old screenshot and a Wiki page that I wrote early on. Emacs with the menu bar enabled - how embarrassing! :-)

The next was taking the same validation little language and implementing it inside our database, to run consistency checks at the end of transactions. This isn't actually very constraint-based, except in its dependency tracking. I borrowed Steele's ideas for generating "why this is invalid" messages automatically (in Swedish and English :-)). That was amazing fun, and all still in heavy use, though the natural language generation didn't scale well as rules got more complicated. I also could have made things much easier for everyone if I was familiar with Hoare's Hints on Programming Language Design -- I'll know better next time :-)

Next was an Erlang GUI with some other guys, this time using a constraint-based interpreter for the same validation language used in the database. The GUI downloaded all the type information and validation constraints from the database and then interpreted them locally. That was really fun to hack, though the project died horribly during the Nortel layoffs. I have a fairly uninformative screenshot of that too.

All in all that is some of the most fun programming I've ever done - and it's GUI stuff! :-)

Ehud Lamm - Re: [The Creation of a Constraint-based Programming Language]  blueArrow
11/16/2002; 2:30:37 AM (reads: 1820, responses: 0)
I hate GUI programming, but this really sounds fun. And oh, it's also an example of the inventor's paradox.

Luke Gorrie - Re: [The Creation of a Constraint-based Programming Language]  blueArrow
11/18/2002; 4:05:51 AM (reads: 1796, responses: 0)
I think the boring part about GUIs is that they are very repetitive to program - lots of writing essentially the same layout and event handling code over and over again. But now I think that's a very exciting characteristic - something that can be great fun to automate, and that nobody else wants to do anyway :-)

It's also very practical. In doing the BMR GUI I spent my time on basically two things: adding forms for new features (layout, input validation, client/server communication), and fixing bugs that were almost all due to client/server protocol errors. Having simple declarative languages for layouts, input checking, and mapping between GUI components and protocol messages (so values always come out from the same place they went in and in the same format) pretty much automated the whole lot. That was great since I really wanted to be hacking Erlang :-)

I think it's really amazing fun to look at the work you do every day, try to express the essense of it as an S-Expression in whatever format comes to mind, and then try to write an interpreter for it :-)

(It also helps to have some gurus around to help you out. I have a wonderful tradition of sending all my pride-and-joy Lisp programs to Darius Bacon, and getting them sent back at 1/4 the original size and making a lot more sense :-))