Notes on implementing concise calls to constructors with type parameters

Neal Gafter neal at gafter.com
Wed May 13 20:27:23 PDT 2009


On Wed, May 13, 2009 at 5:28 PM, Reinier Zwitserloot <
reinier at zwitserloot.com> wrote:

> This boils down to:
>
>
>  - no code that used to compile fine will now compile with errors or
> warnings.
>  - warnings that used to exist will either still exist, or go away,
> or become a different warning.


This is all very hand-wavy.  It isn't clear to me that one can come up with
a straightforward inference algorithm that has these desired properties.
The one I outlined certainly doesn't have this property.  Can you please be
more specific about the inference algorithm you have in mind, and how we'd
demonstrate its soundness?

Showstopper? No problem. Just add a rule that says: If the constructor
> expression is used in a place where the inference engine cannot make
> an unambiguous decision, instead of inferring the lower bound of the
> generics parameter (the Foo in extends Foo), always infer Object.


It isn't clear to me precisely where this rule fits into the current
inference algorithm, or into whatever inference algorithm you have in mind,
without changing the results of inference in many other situations.  Can you
please be more precise about where in the inference process this rule is to
be invoked?

Regards,
Neal



More information about the coin-dev mailing list