"I have a mind like a steel... uh... thingy." Patrick Logan's weblog.

Search This Blog


Wednesday, January 16, 2008

More on "stable layers" regarding efficient dynamic languages

Another data point on the idea of languages implemented in layers, consider this... ("why you should care as a programmer about the study of programming languages")... (pdf)... Dan Friedman's talk at UNAM, Mexico, on April 27, 2001... quoting his student Jonathan Sobel:

“That was the amazing part: I had produced a program that I could not have written, and in any case would not have wanted to write.”
Sobel wrote a program in a simple, direct style using Scheme and then applied several transformations, from Scheme to Scheme, each a fairly simple transformation. The final transformation was ready to be translated into a C program using another simple transformation.

The efficient C program does not have to be maintained. Just the original, simple Scheme program. Probably programming in C itself (or Java or Scala) is a kind of premature optimization.


horia314 said...

The whole idea of compiler / optimizing compiler is that. Take a program written in a higher language and translate it to a lower language. The former is just a concise form of the latter, but they essentially do the same task. Up until some time ago, the only thing we could do was C/C++/Pascal to machine code. Then, we did Java/C# to byte code to machine code. Now we're seeing all kinds of languages translated to all kinds of intermediate languages, all the while increasing power and the distance between "what you write" and "what the machine actually does".
And why not? It makes tasks a whole lot easier for all people involved. The programmers starts thinking in terms of higher-order concepts (lists,macros,objects,functions of functions etc.), the compiler writer doesn't have to target 3 or 4 highly complex processor architectures (just the JVM or the C language), and the virtual machine implementer has a lot of freedom and ways to optimize his little piece of the puzzle.

PS. I've ignored some important programming languages (Lisp,Haskell etc.) from the above lists. Lisp's been doing this sort of think since before the first C compiler ever run, but given today's "popularity view of PL history" that doesn't matter somehow that much.

Patrick Logan said...

given today's "popularity view of PL history" that doesn't matter somehow that much.

PL history won't matter much as long as people write incorrect histories, that's for sure.

Consider UCSD Pascal when you write about byte code machines. This may be the first widely known byte code system and dates from the late 1970s. The UCSD system had its own byte code precursors.


Anonymous said...

mm, maybe a history of languages should be a first year pre-req at uni's, there seems to be a lot of time wasted re-discovering the 70's

Anonymous said...

So, aside from Friedman's book, what do I need to study to become the kind of programming language expert he's talking about?

Patrick Logan said...

"what to study"

Good question. Maybe anything to do with Scheme programming and implementing Scheme. Really. At least in my experience there's nothing that helped me understand programming than what's come out of the Scheme community.

Felleisen's books and papers, including... http://www.htdp.org/

Structure and Interpretation of Computer Programs... http://mitpress.mit.edu/sicp/

The Lambda the Ultimate papers from Guy Steele... http://library.readscheme.org/page1.html... this is "old school scheme" and should be essential reading for programmers.

Essentials of Programming Languages... http://www.schemers.com/scm_bks.html#EOPL2

Blog Archive

About Me

Portland, Oregon, United States
I'm usually writing from my favorite location on the planet, the pacific northwest of the u.s. I write for myself only and unless otherwise specified my posts here should not be taken as representing an official position of my employer. Contact me at my gee mail account, username patrickdlogan.