[Where is type inherence ?] Re: Proposal: Simplified syntax for dealing with parameterized types.

Neal Gafter neal at gafter.com
Mon Mar 23 14:51:21 PDT 2009

On Mon, Mar 23, 2009 at 2:12 PM,  <rssh at gradsoft.com.ua> wrote:
> BTW, are type inference proposal was submitted ?
> May be somebody have plans to  do this ?
> Or exists some consensus that this is not in project coin ?
> Some links:
> http://gafter.blogspot.com/2007/07/constructor-type-inference.html
> // Neal, what you think now ?

Joe Darcy and Jeremy Manson are working on a detailed proposal.  I
still think it's a good idea.

> Exists implementation
> http://weblogs.java.net/blog/forax/archive/2006/12/call_me_santa.html

That's a different approach to shorten some of the same use cases.
For those who aren't aware, Rémi was looking at using "final" instead
of a type on the variable declaration.  See the discussion and
comments on my blog post for opinions about the two alternatives.
Rémi's approach is much simpler (which is a good thing), and has the
advantage that it is usable when the right-hand-side is something
other than just a constructor invocation.  On the other hand, the
constructor-type-inference approach is useful in a few contexts where
the object creation appears somewhere other than directly on the
right-hand-side of an assignment.  If I were to write up the approach
Rémi implemented, the disadvantages section would read

"This is a departure from Java's previous philosophy that all named
entities should be given an explicit type.  Theoretically, it is
possible to intentionally write difficult-to-understand code by using
this construct where the types of the intermediate results are not
clear from context.  In addition, this creates language support for an
idiom that departs from the advice in Effective Java (2nd edition)
Item 52 (use interface types for variable declarations): local code
might unintentionally depend on features of the implementation class
rather than the abstract type.  On the other hand, a few years of
experience with this change in a Java-like language has yielded
virtually uniform positive feedback, suggesting that these are not
problems in practice."

More information about the coin-dev mailing list