Lambda the Ultimate

inactiveTopic Continuations in Java and Java-based Web Frameworks
started 5/26/2004; 9:14:59 AM - last post 6/2/2004; 7:56:59 AM
Noel Welsh - Continuations in Java and Java-based Web Frameworks  blueArrow
5/26/2004; 9:14:59 AM (reads: 12361, responses: 10)
Continuations in Java and Java-based Web Frameworks

I recently came across two Java projects that should be of interest to LtU readers (via this and this blog).

Firstly the Cocoon web framework now supports continuation based applications, via a modified version of the Rhino javascript interpreter.

More interesting is a project to add continuations to Java. If my reading of the code is correct, it works by annotating each basic block with code to store the current environment. These continuations are single use only, so probably not that handy for web applications. Interesting none the less!

So if Java has generics, continuations, pattern matching, AOP and open classes what language innovations are left in our supposedly more advanced languages? It used to be the state-of-the-art was at least 20 years ahead of practice. Has this gap narrowed?


Posted to general by Noel Welsh on 5/26/04; 10:42:49 AM

Daniel Yokomizo - Re: Continuations in Java and Java-based Web Frameworks  blueArrow
5/26/2004; 11:36:49 AM (reads: 822, responses: 0)
So if Java has generics, continuations, pattern matching, AOP and open classes what language innovations are left in our supposedly more advanced languages?

From the top of my head:

Type-classes
Unique types
Lightweight threads (like Erlang)
Declarative Concurrency
Multistaged Programming
Macros
Type inference
Real parametric polymorphism (AFAICS generics in Java don't work for primitives if you don't use auto-boxing)
Partial application (e.g. currying)
First class functions/methods (reflection doesn't really make it)

BTW standard Java have only generics, the other features are part of research projects and don't count as practice. If they counted we should acknowledge Pizza as providing pattern matching and generics to Java.

Andris Birkmanis - Re: Continuations in Java and Java-based Web Frameworks  blueArrow
5/26/2004; 11:59:20 AM (reads: 825, responses: 0)
Firstly the Cocoon web framework now supports continuation based applications, via a modified version of the Rhino javascript interpreter.

Not fair, I said that first ;-)

what language innovations are left in our supposedly more advanced languages?

I am reluctant to view a language as a sum of its features.

Firstly, we can ask, what crippling uncurable warts will be left in Java, even if we add all the features from Daniel's list to this poor beast.

Secondly, eh, well, probably I need to re-read Growing a Language for better arguments.

Robert Sayre - Re: Continuations in Java and Java-based Web Frameworks  blueArrow
5/26/2004; 2:23:11 PM (reads: 770, responses: 0)
No way! I said that first!

Anton van Straaten - Re: Continuations in Java and Java-based Web Frameworks  blueArrow
5/26/2004; 7:53:15 PM (reads: 708, responses: 0)
So if Java has generics, continuations, pattern matching, AOP and open classes what language innovations are left in our supposedly more advanced languages?

Usability?

Seriously, I think there's still a huge gap in terms of how these features all integrate, and I don't think a language like Java will ever be able to fix that, not without major reinvention.

I find working with Java conceptually to be fine: you can design very reusable interface hierarchies, etc. But actually churning out the code is still an exercise in tedium. Java is the new COBOL.

Ehud Lamm - Re: Continuations in Java and Java-based Web Frameworks  blueArrow
5/27/2004; 5:04:33 AM (reads: 622, responses: 0)
Tail call optimization?

Noel Welsh - Re: Continuations in Java and Java-based Web Frameworks  blueArrow
5/28/2004; 6:50:49 AM (reads: 408, responses: 2)
I'd didn't really think Java is very close to <your favourite language>; I just threw that in as I knew people would respond to it. But I think it does appear as if programming language theory is propogating through the community faster than in the past. I'm amazed to see Java programmers, in the orthodoxy of Jakarta, using continuations. I think this is a Good Thing, though I'd rather use a different language. I agree with most of the objections raised above, particularly Daniel's point about research vs practice, and Anton's point about usability. And mea culpa for the unacknowledged repost!

Ehud Lamm - Re: Continuations in Java and Java-based Web Frameworks  blueArrow
5/28/2004; 6:56:49 AM (reads: 413, responses: 0)
But I think it does appear as if programming language theory is propogating through the community faster than in the past.

It does seem so, doesn't it?

Andris Birkmanis - Re: Continuations in Java and Java-based Web Frameworks  blueArrow
5/28/2004; 11:19:00 AM (reads: 383, responses: 0)
And mea culpa for the unacknowledged repost!

I hope you understood my somewhat twisted humor :-)

programming language theory is propogating through the community faster than in the past.

Absolutely - less than a year ago I had no clue about type inference, and could not tell a first-class continuation from a closure. Thanks to some people on LtU I got interested in theory of PLs, and now I have big troubles using Java in my everyday job :-)

What's the most amazing, though, is that I managed to get MSCS diploma with thinking that Java, EJBs, and UML are the best things there are :-(

Jerry Boetje - Re: Continuations in Java and Java-based Web Frameworks  blueArrow
6/2/2004; 7:56:48 AM (reads: 311, responses: 0)
Betraying my obvious bias, much of what people ask for is available in Common Lisp - either directly or write it yourself. The only problem with this approach is that CL doesn't play well with Java (or anything else either!). But that may be moot in a few years.

It's still in the early stages, but in the CS dept of the College of Charleston we're building a full implementation of Common Lisp that compiles directly to Java byte code. One of the goals of this project (aside from its primary goal to give students a real-world development experience) is to make calling between Java source and Lisp source totally transparent - dispensing with the usual foreign-function garbage.

Our current compiler is just a bootstrap implementation with no optimizations. But we'll be moving to a Lisp-based compiler which will handle CPS conversions etc. A side-effect of this is support for operators such as call/cc. By compiling directly to byte codes, we can avoid a lot of Java language issues.

You're welcome to look at our Wiki via the TWikiguest account. The quality of documentation varies - this is a student undertaking after all. We are officially at version 0.2 and not yet releasing it to the open source community (we want the students to go all the way to 1.0). But comments are always welcome. There are 2 blogs that cover the day-to-day operation of the project.