Lambda the Ultimate

inactiveTopic Udell: Programs that write programs
started 2/11/2004; 9:17:05 AM - last post 2/15/2004; 12:06:27 PM
Ehud Lamm - Udell: Programs that write programs  blueArrow
2/11/2004; 9:17:05 AM (reads: 10412, responses: 10)
Udell: Programs that write programs
Worth a look.

Jon Bentley in Bumper-Sticker Computer Science quotes Dick Sites as saying I'd rather write programs to write programs than write programs.

For some reason I remembered this quote as saying I'd rather write programs to write programs to write programs than write programs to write programs.

But maybe that's just me...


Posted to Software-Eng by Ehud Lamm on 2/11/04; 9:22:00 AM

John Carter - Re: Udell: Programs that write programs  blueArrow
2/11/2004; 7:50:05 PM (reads: 523, responses: 2)
I would rather write witty epigrams on programming than write programs that write programs that write programs.

Ehud Lamm - Re: Udell: Programs that write programs  blueArrow
2/12/2004; 12:39:57 AM (reads: 487, responses: 0)
Ha!

Dan Shappir - Re: Udell: Programs that write programs  blueArrow
2/12/2004; 12:43:15 AM (reads: 490, responses: 0)
gen<x> R.I.P.

Peter Van Roy - Re: Udell: Programs that write programs  blueArrow
2/12/2004; 3:35:58 AM (reads: 455, responses: 2)
I'd rather write programs to write programs than write programs.

This is a dangerous rule. Writing a program to solve a problem instead of solving the problem directly is tempting, but it's the wrong default. A program-writing program has a life of its own: it has to be debugged and maintained. Its limitations become accepted ("what the program does is what I wanted after all"). Its benefits are almost never as big as its enthusiastic designer wants to believe. Before writing one, make doubly sure that you're not falling into this trap!

The tendency to build 'systems' to solve problems instead of solving the problems directly is well-known as a bad default. See "The Systems Bible" by John Gall for more explanation.

Ehud Lamm - Re: Udell: Programs that write programs  blueArrow
2/12/2004; 4:05:26 AM (reads: 461, responses: 1)
Is everyone here humor-challanged today?

Frank Atanassow - Re: Udell: Programs that write programs  blueArrow
2/12/2004; 7:39:11 AM (reads: 394, responses: 1)
It's really the Dave Thomas article that is of interest here. Like the CLR interviews, I have a lot of bones to pick with Thomas' claims, and if I have time I'll post a critique here.

Ehud Lamm - Re: Udell: Programs that write programs  blueArrow
2/12/2004; 7:47:33 AM (reads: 397, responses: 0)
Anyone interested in these issues should check the recent work on staging. Quite a few remarkable papers are out there. If I have time I'll post the links here...

Matt Hellige - Re: Udell: Programs that write programs  blueArrow
2/12/2004; 11:39:12 AM (reads: 347, responses: 0)
I actually prefer writing programs that write themselves...

John Skaller - Re: Udell: Programs that write programs  blueArrow
2/13/2004; 11:31:08 PM (reads: 185, responses: 0)
Self modifying code, yeah!

Heh. Languages like Lisp and Forth are not only good at generating code, from one angle, its the only way to program them. The simple term structures that allow for easy code generation also fail to provide enough redundancy for human readers and static type checking.

More complex languages can be multi-staged, for example MetaOcaml, but the result would seem to be that such languages aren't useful: the annotation is just too much to cope with.

Partial evaluators look much better to me: its basically a multi-stage compiler where the 'staging' is detected automatically, without annotations .. but all compilers do this anyhow, under the name 'optimisation'. The big problem is you have no idea what optimisations were actually done.

The two approaches (explicit annotation and no annotation) might admit a useful middle ground. The idea is that you don't tell the compiler how to optimise, nor what to optimise, but you do provide annotations which specify *complexity* requirements.

As an example, consider matrix multiplication which is O(N^3) for unknown matrices. If one of the matricies is known to be diagonal, its O(N^2). So if you could annotate:

matrix x = A * B : O(dim(A) ^ 2)

a partial evaluator could either optimise to O(N^2) or report an error .. leaving you to figure out why its automated reasoning failed to detect the optimisation.

This is a really crude idea as stated: more generically I guess one might like to see a more 'type like' notion to write the complexity notion with, since both are abstractions used as constraints.

Ehud Lamm - Re: Udell: Programs that write programs  blueArrow
2/15/2004; 12:06:27 PM (reads: 145, responses: 0)
Udell has some more to say on the subject. Here's a taste:

The cultural anthropology of programming languages is a fascinating subject. Recently, for example, I asked an accomplished developer with deep roots in the Microsoft programming culture to cite his favorite productivity aids in the .NET Framework. Regular expressions made his short list. That floored me, since regexes are just part of the atmosphere that Unix and open source programmers have always breathed. But a lot of Microsoft programmers didn't grow up breathing that atmosphere.