Tail recursion in Scala and Annotations for Software Defect Detection

The Java Posse interview with Brian Goetz and Bill Pugh cleared up how Scala supports tail recursion in spite of the JVM's lack of support.  Brian Goetz did a great job of explaining that currently compiler writers have to build in the support (which Scala does) because the language doesn't support it directly.  He went on to explain that while there is support in the CLR for tail recursion, the F# compiler writers chose not to use it in some cases because they found that they could write a more optimal version by converting to iteration.  

The conversation was about changes that can be expected in Java 7, including JSR 292 ("Enhancements for Other Languages", aka "Invoke Dynamic"), JSR 305 (Annotations for Software Defect Detection), and JSR 308 (Annotations on Java Types).  

The discussion of JSR 305 (and @NonNull) reminded me of the discussion of contracts in a podcast on Microsoft Spec# that I listened to a few weeks ago. Scott Hanselman did an accompanying blog post as well. The FindBugs (static analysis) tool that Bill Pugh did is definitely a "must-have", and can already support annotions such as described above.  The JSR would simply provide a naming convention so that all tool makers and programmers could agree.  I had to look up Bill's annotation to see if it was "NotNull" or "NonNull", for example!

Note: JSRs (Java Specification Requests) are formal requests through the JCP (Java Community Process) for changes or enhancements to Java and the Java Virtual Machine.  This is an open process and participation is encouraged.