2009/11/18

Devoxx 2009: Project Coin

18/11/2009, Joe D. Darcy, Sun

slides: http://blogs.sun.com/darcy/entry/project_coin_devoxx_2009

Project Coin
  • small language changes in JDK7
  • keep broad consideration of java landscape → remain consistent with the Java Language
  • bigger language changes, not in scope of Project Coin
    • JSR308: annotations to improve static checkers (e.g. @NotNull)
    • JSR294: modularity
principles of Project Coin:
  • reading more important than writing
    • 'beautiful' code
    • don't hide what's happening
  • simplicity matters
  • no slash-and-burn: remember broad user-base
  • balance stability versus progress
  • prefer library / IDE changes over language changes (String.join)
  • no new keywords
  • no type system changes
  • small in specification, implementation and testing
methodology:
  • open: blog entries / white board on Devoxx2008
  • call for proposals
  • prototypes recommended
    • lot of work
    • very beneficial → learn / find issues
  • existing requests for enhancement: 120 changes → too much
final list of Project Coin enhancements
  • numbers:
    • binary notation: 0b00100100001
    • group numbers with '_': long big = 1_123_456_789;
  • switch on a String – really cool!
    • specification: only one word added
    • proposal contains a suggested implementation:
      • uses String.hashCode() for an initial switch
    • big patch in javac
    • lots of tests to validate change
      • reject pre -source 7 classes
      • null behavior
      • hash collisions
      • fall-throughs
      • → comparable to enum switch control flow
  • diamond <> operator : type interference → e.g. Map <String,String> map = new HashMap<>();
    • a lot of prototyping work
    • quantitative analysis
    • some concerns on language evolution were considered
  • JSR292: invokedynamic for dynamic languages
  • auto-close of Closable types within a special try block (ARM)
    • try(File f = new File) {} → f is automatically closed when leaving the block
  • simplified varargs method invocation, working along with generics
  • language support for Lists and Maps:
    • List<String> list = [“1”, “2”];
    • list[0]
    • map{“hello”}
not retained in Project coin:
  • Elvis operator:
    • use ?: as a shorthand for testing on null
    • conclusion from building a prototype→ doesn't fit well in java
  • multiple exception handling
    • disjunctive means of | operator
  • properties:
    • changes the type system
    • a lot of work (e.g. reflection api, corner cases …) – the 'enum' specification is demonstrated as a comparable change that involved a lot of rework
    • pseudo-properties workaround: via annotation-processing → Project Lombok
  • reified generics
    • source language compatibility issues – java generic erasure was chosen for backward compatibility
    • C# created a separate generic library
    • difficult for other languages to target the a platform with reified generics
  • extensible enums
    • most enums are constant
    • low utility

No comments: