Welcome to JavaPolis 2007!
Disclaimer: Talk Represents My Opinion, Not Google's!
Outline
The feel of Java
Oak
The Java Language
Java - a language for a job
Practical, not theoretical
No new ideas here
Don't fix it until it chafes
Java feels...
The feel of Java
So How Are We Doing? Not So Well, Unfortunately
What the Man on the Web is Saying
Where Does The Complexity Come From?
If The Feel of Java is to be Preserved...
Outline
What is a Closure?
Why Are We Considering Better Support for Closures?
1. Fine-grained (fork-join) concurrency
Here's How it Looks Today
2. Automatic Resource Management
How it Looks Today-Manual Resource Management
It's Worse With Multiple Resources (Puzzler 41)
Automatic Resource Management
Outline
Controversial Features in BGGA
Function Types
Function Types are Hard to Read
Function Types Encourage an "Exotic" Programming Style
Nominal Types are Rich Compared to Function Types
Function Types Have Unexpected Interactions
Function Types Limit Interoperability With SAM Types
Summary - Pros and Cons of Function Types
BGGA Closures Have Two Kinds of Returns
What Does test() Return?
Now What Does test() Return? (BGGA)
Now What Does test() Return? (BGGA)
Suppose You Wanted to Translate this Method to BGGA
It's Awkward, as Only One Local Return is Permitted
Summary - Pros and Cons of Non-Local Returns
What Does This Program Print?
What does this program print?
Summary - Pros and Cons of Access to Nonfinal Locals
Library-Defined Control Constructs
Custom for-loops (Example from BGGA Spec)
What's Wrong With This example?
Custom for-loops (Example from BGGA Spec)
What's Wrong With This example?
Loop syntax tailored to for; awkward for while
Automatic Resource Management Block (BGGA Spec)
Library-Defined Control Constructs are a Double-Edged Sword
Performance is an Open Question
Summary - Programmer-Defined Control Constructs
Outline
A Lightweight Approach
Concise Instance Creation Expressions (CICE)
Automatic Resource Management (ARM) Blocks
More Automatic Resource Management Blocks
For More Information
Outline
The Closures Spectrum
The Big Questions
The Medium-Sized Questions
Moving Forward, There are Two Approaches
Closing Sermon
Last year Neal Gafter premiered his BGGA Closures proposal at JavaPolis. One year later Joshua Bloch presented his view on the Closures Controversy and why he feels that CICE is a more suitable approach. One way to look at the available proposals is to consider the impact on Java as a language: whether it's possible to undergo fundamental change while still preserving the 'Feel of Java'.
Joshua Bloch is a Principal Engineer at Google. He was previously a Distinguished Engineer at Sun Microsystems and a Senior Systems Designer at Transarc. He led the design and implementation of numerous Java platform features, including the JDK 5.0 language enhancements and the Java Collections Framework. He is the author of the Jolt Award-winning book Effective Java. He holds a Ph.D. in Computer Science from Carnegie-Mellon University and a B.S. in Computer Science from Columbia.