diamond operator & implementation strategies (v3)
neal at gafter.com
Mon Aug 24 18:20:11 PDT 2009
On Mon, Aug 24, 2009 at 6:04 PM, Rémi Forax <forax at univ-mlv.fr> wrote:
> no arg constructor in method call => problem.
> Correct me if I'm wrong but currently inference of method type
> parameters also fails.
> So It's not a big deal.
What Maurizio calls the "complex" diamond inference approach is actually the
existing generic method inference algorithm, but applied to constructors. I
prefer to call it the "compatible" algorithm. The current method type
inference has a straightforward extension to handle argument contexts that I
expect is likely to be considered for a future extension. It was actually
in some late JSR14 prototypes, but removed in the latest versions due to
concerns about the alignment of the spec and the implementation. The
compatible algorithm would naturally get the benefits of any improvement to
method inference, including for argument contexts. The "simple" version, on
the other hand, does not have a straightforward extension to inference in
In short, it mainly a big deal if the future evolution of the language is
The main reason that I've heard for preferring the "simple" algorithm is
that it is simpler. How many lines of code were required for each
approach? Now that both algorithms have been implemented that should hardly
be much of a consideration, but it would be nice to know.
More information about the coin-dev