Type Inference: Friend or Foe

Session abstract

Java 10 has local variable type inference, but type inference is not really new in Java. Is type inference good or bad? Are there challenges and limitations to using it? When is a good time to use type inference? This presentation includes details of Java 10 type inference but certainly goes beyond them. It steps back and discusses type inference from the programmer’s point of view and works through the benefits and caveats. At the end of the session, you will be able to decide when to use it and when to avoid it.

Speaker(s)

Name Title Company
Venkat Subramaniam President, Agile Developer Inc.

Session Info

Session type Track
Developer Session Core Java Platform

My Notes

Venkat goes into the code just about immediately and demoes type inference with haskell.

Java has been steadily adding type inference since java 5.

He has like lightning fast demoes that I can not summarize here as I wanted to follow it myself.

Just if you have the chance go see him!

👍

“Don’t tell the obvious!”

var is not a keyword !

Be careful with refactoring to var.

Bad liskov substitution

Really fun examples!

benefits

  • reduce clutter
  • easy to evolve
  • easier to reuse
  • life saver during debugging
  • targeted intersection types
  • anonymous non-denotable types

Does the compiler work for me or do I work for the compiler?